Bala about 14 years ago. Michael about 14 years ago. Anonymous about 14 years ago. Ryan R. August Lilleaas about 14 years ago. Dan Pickett almost 14 years ago. Vivek Khokhar almost 14 years ago.
Erik Petersen over 13 years ago. Chase Southard over 13 years ago. Can this be used with Helpers? If so, what am I missing? Yes it does work with helpers provided that you actually load the correct part of the yaml file. Thank again, Ryan! Henrik N about 13 years ago. Joe Adams about 13 years ago. RaislNewbie almost 13 years ago.
RailsDevSea almost 13 years ago. Stewart Johnson over 12 years ago. Thanks for the great screencast! Keenan Brock over 11 years ago. Semyon over 11 years ago. In Rails 3 application path is Rails. Keil Miller Jr about 10 years ago.
Also, don't forget that Rails. ENV in rails 3! Rails 3 do ruby. Pete Lasko over 11 years ago. Semyon thank you for putting this comment.
There's no way I would have figured this out. If you look in the application. There is plenty of documentation on how to access the variable edgeguides.
Jack Pratt you could edit a more complete answer? Beware that if you set something only in production, and try to access it in another environment, it would complain undefined method. Show 14 more comments. Update 1 Very recommended: I'm going with Rails Config gem nowadays for the fine grained control it provides.
Update2 If you want a quick solution, then check Jack Pratt's answer below. Community Bot 1 1 1 silver badge. This answer is out-dated.
See stackoverflow. Thanks for pointing out the outdated. I hate that about Rails -- code from 1 year ago is too old. In the documentation they instruct me to register RailsConfig in my app. I assume that app. But where in the application. In Rails 3. Rory O'Kane Rob Dawson Rob Dawson 1, 10 10 silver badges 20 20 bronze badges. I Tried this in rails 4.
I was trying to add "config. Spundun You're getting that error, because Rails doesn't know what store is. Thanks, I eventually figured that out. That these are nested hashes so I have to initialize empty hashes recursively if I'm to use dots in my config names. This works in rails 3.
Alain Beauvois Alain Beauvois 5, 3 3 gold badges 42 42 silver badges 25 25 bronze badges. Flov Flov 1, 16 16 silver badges 23 23 bronze badges. Rails 6 Many outdated answers, so adding one that is specific to Rails 6. The official repo is now at: github.
Rahil Sondhi Rahil Sondhi 6 6 silver badges 7 7 bronze badges. Loving this so far. MikeH MikeH 7 7 silver badges 17 17 bronze badges. I dint wanna use additional plugins etc, as I am learning rails, so the best way to do it would be without any plugins. Note this uses database to store configurations, which maybe too heavy for some people. As you know, Rails reads this file automatically chooses the database connection base on the current Rails environment.
Starting with Rails 4. It takes a symbol or string which is the name of a YAML file in the rails config directory. As you can see, it returns a hash of the config for the current Rails environment.
0コメント