A nice way to do this is to place a yml file in the config folder
like my_app.yml
and read it in application.rb
MY_CONFIG = YAML.load(File.read("config/my_app.yml")) unless defined?
(MY_CONFIG)
you can define different files for different environments like
my_app_test.yml
my_app_development.yml
my_app_production.yml
and load with
MY_CONFIG = YAML.load(File.read("config/my_app_#{Rails.env}.yml"))
unless defined?(MY_CONFIG)
On Sep 29, 9:41 am, comopasta Gr <[email protected]> wrote:
> Hi,
>
> I want to store 6 palettes with color information.
>
> This info should be accessed from a couple of places in my app. From one
> controller and from one module I have.
>
> I'm not sure what would be the best way to do it.
>
> In some hashes?
>
> red_palette = { :background => "abcdef", :header => "fedefg" }
> blue_paletter = { :background => "12ed34", :header => "abdefg" }
> ...
>
> In yml?
>
> red_palette:
> background: abcdef
> header: fedefg
>
> I guess I could make a small module and require it, but then I need to
> require it two times. I'm starting to think about memory even though for
> this it would be very cheap anyway.
>
> Any advices? I'm on Rails 3.0.5
> Thanks.
>
> --
> Posted viahttp://www.ruby-forum.com/.
--
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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.