0

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

1
  • did you restart server before accessing the config? Commented Jan 10, 2019 at 20:59

1 Answer 1

1

Rails.application.config.default_page_logo

But better solution is https://github.com/binarylogic/settingslogic

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.