Hi there! After reading up in the wiki, I was wondering about adding a certain configuration variable to my rails app. What''s the "best way to do it"? What are you using? I''m coming from Django, where you have a settings object you import from django.conf.settings. This provides for a unique point to check on settings. It also makes it easy to fake settings for testing purposes using a mock''ed settings object. What''s the idea behind rails settings? Just global vars? A certain object''s properties, like in django? Are they just vars "injected" into the environment? Where do I check and maybe alter the settings in runtime? I''m aware that some of the above might not be "the path to light", but my engineer mind needs to understand it all, how it works, in and out. And rails is anything but transparent, with all that magic ;) Thanks everyone! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
You can add your own settings to configuration class. Look in your config/environment.rb. Here is some documentation on it http://railsmanual.com/class/Rails::Configuration. -Bill Chris Hoeppner wrote:> Hi there! > > After reading up in the wiki, I was wondering about adding a certain > configuration variable to my rails app. What''s the "best way to do it"? > What are you using? > > I''m coming from Django, where you have a settings object you import from > django.conf.settings. This provides for a unique point to check on > settings. It also makes it easy to fake settings for testing purposes > using a mock''ed settings object. > > What''s the idea behind rails settings? Just global vars? A certain > object''s properties, like in django? Are they just vars "injected" into > the environment? Where do I check and maybe alter the settings in > runtime? > > I''m aware that some of the above might not be "the path to light", but > my engineer mind needs to understand it all, how it works, in and out. > And rails is anything but transparent, with all that magic ;) > > Thanks everyone! > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 2007-10-27 16:52:07 -0700, Chris Hoeppner <hoeppner-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> said:> Hi there! > > After reading up in the wiki, I was wondering about adding a certain > configuration variable to my rails app. What''s the "best way to do it"? > What are you using?What I do: # in config/environment.rb Module Site HOME_PLANET = 3 end Then you can call on Site::HOME_PLANET from anywhere. Rails 2 also allows for loading config settings from any file under config/initializers/ so you can modularize and organize even further. --Andrew Vit --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---