Simple global settings for your Rails app
If you’ve got some global settings and don’t want to bother storing them in the database or YAML, here’s a quick way to get easy dotted notation access to them:
ApplicationSettings = OpenStruct.new(
:some_variable => true,
:complex_settings => { :one => [:two,:three,:four],
:foo => { :bar => :baz
}
}
)
Then you can simply access it via ApplicationSettings.complex_settings.one. Quick & dirty, or quick & clean?










2 Comments