gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-04 06:00:33 25 4
gpt4 key购买 nike

我在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


我尝试并一次又一次地尝试了这些步骤,最终遇到了相同的错误。
如果您能帮助我,那就太好了!

最佳答案

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

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

关于ruby-on-rails - Heroku登台应用程序崩溃(无法读取环境/staging.rb),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8216249/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com