Reputation: 6259
In my rails app i created an extra model for settings. Im wondering if there is anything better to safe the settings! The thing is that settings represent one instance of this model! I considerd to safe my settings to a yaml file but the probem is that then i cannot easily call them in my controllers? What would you suggest? Thanks
Upvotes: 1
Views: 41
Reputation: 43815
I believe you're talking about application based settings? If so we use the application's config file to put global settings. The config looks like this:
# config/environments/production.rb
Application.configure do
config.setting = true
end
You can access the setting via:
Rails.application.config.setting
The nice bit about this is that you can do settings based on each individual environment.
Upvotes: 1