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
Rails.application.config.default_page_logo
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.