I'm in the process of building a rails plugin to automate my teams deployment process.. Problem is I can't find a way to access teh rails env variable. I have the following:
config = YAML.load(File.open("#{Dir.getwd}/config/s3.yml"))[RAILS_ENV]
That errors with:
in `cons开发者_运维技巧t_missing_from_s3_library': uninitialized constant Heroku::Command::Jammit::RAILS_ENV (NameError)
Anyone know how? Thanks
You should be using Rails.env
instead of RAILS_ENV
with Rails 3 and up. Try using:
config = YAML.load(File.open("#{Dir.getwd}/config/s3.yml"))[Rails.env]
Or this if you get scope issues with just Rails
:
config = YAML.load(File.open("#{Dir.getwd}/config/s3.yml"))[::Rails.env]
精彩评论