On Jan 3, 2007, at 12:42 PM, cliffeh wrote:
> I would like to have a global configuration setting (an interest rate)
> that''s settable by the administrator, but would be used in
> calculations
> throughout the app. I''m OK with setting up a single-field, single-
> value
> database table, and an A/R model.
>
> However, is there a pattern for ensuring that there is always one and
> only one record in the table?
I don''t like people to touch the database. The pattern we follow is.
There is a config/application.yml.example in svn with those kind of
external configuration parameters which are specific for this
application. The install process says you copy that file to config/
application.yml and change the defaults from the example.
Then in config/environemnt.rb we load it in a global hash:
# Load application configuration constants
require ''yaml''
APPLICATION_CONFIG = YAML::load(File.open(File.join(RAILS_ROOT,
''config'', ''application.yml'')))
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---