The Rails way is a little unobvious at first:
At the bottom of your environment.rb file, do something like this
(taken from the salted login generator):
require ''yaml''
CONFIG = YAML::load(File.open("#{RAILS_ROOT}/config/environments/app-
config-#{RAILS_ENV}.yml"))
Then, add the corresponding yml files in config/environments/app-
config-*.yml (for example, config/environments/app-config-
development.yml).
Your yml file should look something like this:
email_from: Film Fury
admin_email: duane.johnson-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
server_env: development
You can access the configuration with the CONFIG[] array (or whatever
array name you choose).
This method adds a lot of versatility to your app, allowing you to
develop under one environment and then release your code in another.
Very handy.
-- Duane Johnson
(canadaduane)
On May 2, 2005, at 2:00 PM, Frank Kim wrote:
> Hi,
>
> Where is a good place to store your constants, for example, for page
> locations? Right now I store them in the application_helper.rb file
> but I am not sure if that is the best way to do thing.
>
> Thanks,
> Frank
> _______________________________________________
> Rails mailing list
> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>