title: How to fix "no implicit conversion of nil into String" in Ruby
body: <p>I am developing one small web application in my local machine. I want to set my some common information globally.
  Here is my code:</p>
  <p><em>app/controllers/concerns/site_configuration.rb</em></p>
  <pre><code>module SiteConfiguration
    mattr_accessor :site_name
    mattr_accessor :banner_path
    mattr_accessor :avatar_path  
    mattr_accessor :gallery_path  
    mattr_accessor :category_path  
  end
  </code></pre>
  <p><em>config/environment.rb</em></p>
  <pre><code>SiteConfiguration.site_name = 'Site Name Here'
  SiteConfiguration.banner_path = 'uploads/banners/'
  SiteConfiguration.avatar_path = 'uploads/avatar/'
  SiteConfiguration.gallery_path = 'uploads/gallery/'
  SiteConfiguration.category_path = 'uploads/category/'
  </code></pre>
  <p><em>app/views/galleries/index.html.erb</em></p>
  <pre><code>&lt;img src=&quot;&lt;%=root_path+SiteConfiguration.gallery_path+@gallery.image %&gt;&quot; alt=&quot;&quot; /&gt;
  </code></pre>
  <p><strong>Here is I am getting error message</strong></p>
  <blockquote>
  <p>TypeError in Galleries#index</p>
  <p>Showing D:/xxx/project/app/views/galleries/index.html.erb where line #1 raised:</p>
  <p>no implicit conversion of nil into String</p>
  </blockquote>
  <p>Above code working fine. But one big problem is whatever changes I made every time there is a need to restart the server.</p>
  <p>If I restart server then its working fine. After few min if need any changes I am getting same error message. Let me know what is the problem there?</p>