Heroku登台应用程序崩溃(无法读取环境/ staging.rb)

时间:2011-11-21 17:57:31

标签: ruby-on-rails heroku mongoid staging

我在Heroku上有一个制作应用程序 - productionapp.heroku.com

所以,我按照步骤为它创建了一个临时应用程序:

1. heroku create stagingapp  --remote staging
2. heroku config:add RACK_ENV=staging  --app stagingapp
3. heroku addons:add mongohq:free  --app stagingapp
4. In config/mongoid.yml -
   add
     staging:
       uri: <%= ENV['MONGOHQ_URL'] %>
5. cp config/environments/production.rb config/environments/staging.rb
6. Add the MONGOHQ_URL in the mongohq.com connection.
6. git push staging master

暂存应用程序不断崩溃,并带有以下回溯:

2011-11-21T17:43:23+00:00 app[web.1]: 
You did not specify how you would like Rails to report deprecation notices for your staging environment,
please set config.active_support.deprecation to :log, :notify or :stderr at config/environment

2011-11-21T17:43:24+00:00 app[web.1]:
/app/.bundle/gems/ruby/1.9.1/gems/mongoid-2.3.3/lib/mongoid/railtie.rb:64:in `block in <class:Railtie>':
undefined method `values' for nil:NilClass (NoMethodError)

2011-11-21T17:43:24+00:00 app[web.1]:
from /app/.bundle/gems/ruby/1.9.1/gems/railties-3.1.1/lib/rails/initializable.rb:30:in `instance_exec'

2011-11-21T17:43:24+00:00 app[web.1]:
from /app/.bundle/gems/ruby/1.9.1/gems/railties-3.1.1/lib/rails/initializable.rb:30:in `run'

2011-11-21T17:43:24+00:00 app[web.1]:
from /app/.bundle/gems/ruby/1.9.1/gems/railties-3.1.1/lib/rails/initializable.rb:55:in `block in run_initialize

我一次又一次地尝试并重试这些步骤并最终遇到同样的错误。 如果你能帮帮我的话会很棒!

1 个答案:

答案 0 :(得分:1)

我猜你没有正确添加配置,因为这是在mongoid中失败的行

YAML.load(ERB.new(File.read(config_file)).result)[Rails.env].values.flatten.any?