Ruby on Rails Wednesday, November 24, 2010

Another alternative is to just use the existing rails environment
config or initializers file(s) to store such info in memory, something
like:

$ cat ./config/environment.rb
...
APP_VALS = {
:default_company_name = 'My Company',
}
...

$ ./script/console
...
>> APP_VALS[:default_company_name]
=> "My Company"

If you wanted different vals per environment (ie test, development,
production), then you could define APP_VALS in each of those
environment config files.

Jeff

On Nov 24, 7:36 am, Owain <owain.mcgu...@gmail.com> wrote:
> > However isn't there a better way to do this? Initially I thought I could
> > do something more elegant like this:
>
> How about moving the config out of the code by using the plugin.https://github.com/cjbottaro/app_config
>
> You can put your defaults in a file default.yml and then "over-ride"
> with them with a separate production.yml etc etc.

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment