Reputation: 63
I have a custom variable in my config/application.rb
that I want to access from one of my models.
The variable is defined in config/application.rb
like so:
config.default_page_logo = 'pagelogo.png'
And I'm trying to access it from the model in a method roughly similar to this:
def logo_type
logo = client.logo if is_client && client.has_logo
logo || Rails.configuration.default_page_logo
end
In the browser I get the following error:
NoMethodError in Home#dashboard
undefined method 'default_page_logo' for Rails::Application::Configuration:0x0000564b1b468680
I'm running Ruby 2.4.3 and Rails 5.1.4
Upvotes: 0
Views: 279
Reputation: 25
Rails.application.config.default_page_logo
But better solution is https://github.com/binarylogic/settingslogic
Upvotes: 1