When I am writing a Rails application it kind of makes sense to have custom configuration options. In Rails 4.2.5 I tried to add these to a config file in the config directory for the environment that gets loaded but I get an error:
/Users/bytenel/.rvm/gems/ruby-2.0.0-p643/gems/railties-4.2.5/lib/rails/railtie/configuration.rb:95:in method_missing': undefined method wepay’ for #Rails::Application::Configuration:0x007fde51d21450 (NoMethodError)
Since I am trying to use my configuration like so:
Rails.configuration.wepay.client_id or alternatively Rails.application.webpay.client_id
It would be nice to do this since it has a good ring to it semantically for my configuration variables and makes sense to the location of it (I can easily check my Rails config file for the environment to check the loading).
Such a configuration would look like this:
Rails.application.configure do config.wepay.use_stage = false config.wepay.client_id = ‘your_client_id’ config.wepay.client_secret = ‘your_client_secret’ end
Rather than using the generic
Rails.application.configure do
config.x.wepay.use_stage
end
Or some such.
What does the team think?