I am developing one small web application in my local machine. I want to set my some common information globally. Here is my code:
app/controllers/concerns/site_configuration.rb
module SiteConfiguration
mattr_accessor :site_name
mattr_accessor :banner_path
mattr_accessor :avatar_path
mattr_accessor :gallery_path
mattr_accessor :category_path
end
config/environment.rb
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/'
app/views/galleries/index.html.erb
<img src="<%[email protected] %>" alt="" />
Here is I am getting error message
TypeError in Galleries#index
Showing D:/xxx/project/app/views/galleries/index.html.erb where line #1 raised:
no implicit conversion of nil into String
Above code working fine. But one big problem is whatever changes I made every time there is a need to restart the server.
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?