bot*_*bot 1 yaml ruby-on-rails ruby-on-rails-3
是否仍然认为在/ config目录中使用yaml文件在environment.rb中加载一些配置参数是最佳做法?这似乎是一个非常好的方法,但如果有更好的方法,那么了解它会很好.我试图找到有关在Rails/YAML中加载配置设置的文章,但大多数文章都没有超过2009年.让我觉得有更好的(或新的标准)方法来做到这一点.谢谢!
我最近一直在使用这个宝石:
基本上,您创建一个/config/application.yml
看起来像这样的文件:
defaults: &defaults
api:
johns_api_co:
api_key: my_key
secret: shh!!!
other_setting:
this: "is a config setting"
that: "and another thing"
development:
<<: *defaults
test:
<<: *defaults
production:
<<: *defaults
Run Code Online (Sandbox Code Playgroud)
有很多方法可以做到这一点,但这很好用,非常简单.