What is the best way to have a configuration file in Ruby on Rails? I just want something that will set values that I can use later (paths, parameters and such). It would be nice if there were an easy way to set defaults as well, but that isn''t required. I don''t really care if it is key=value or apache style. Thanks! -- Posted via http://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 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 -~----------~----~----~----~------~----~------~--~---
On 14 Dec 2006, at 23:07, Jonathan Dobbie wrote:> > What is the best way to have a configuration file in Ruby on Rails? > > I just want something that will set values that I can use later > (paths, > parameters and such). It would be nice if there were an easy way > to set > defaults as well, but that isn''t required. I don''t really care if > it is > key=value or apache style.You could either create constants in your config/environment.rb file (or config/environments/{development, test, production}.rb) which you can refer to elsewhere in your code, or you could load, say, a YAML file in config/environment.rb and assign the YAML to a constant. Here''s an example of the latter: http://www.realityforge.org/articles/2006/02/28/flexible-application- configuration-in-rails Regards, Andy Stewart --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Thank you, the article covers what I want to do. -- Posted via http://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 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 -~----------~----~----~----~------~----~------~--~---