Heroku在db:migrate rake上抛出错误

时间:2015-10-27 15:46:23

标签: ruby-on-rails heroku

当我试图按照Michael Hartl在RoR教程中所说的那样抛出heroku run rake db:migrate时,它引发了以下内容:

Running rake db:migrate on shielded-reaches-4728... up, run.2183
rake aborted!
NoMethodError: undefined method 'configure' for #<SampleApp::Application:0x007efe8ced6138>
/app/config/environments/production.rb:1:in '<top (required)>'
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in 'require'
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in 'block in require'
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in 'load_dependency'
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in 'require'
..
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)

我该怎么办?

更新: 这是我的 production.rb 文件:

Rails.application.configure do

  config.cache_classes = true

  config.eager_load = true

  config.consider_all_requests_local       = false
  config.action_controller.perform_caching = true

  config.serve_static_assets = false

  config.assets.js_compressor = :uglifier

  config.assets.compile = false

  config.assets.digest = true

  config.log_level = :info

  config.i18n.fallbacks = true

  config.active_support.deprecation = :notify

  config.log_formatter = ::Logger::Formatter.new
  config.active_record.dump_schema_after_migration = false
end

1 个答案:

答案 0 :(得分:0)

看起来你有类似的东西

...

module SampleApp
  class Application < Rails::Application

...

application.rb文件中。在这种情况下,在production.rb文件中,您需要更改

Rails.application.configure

SampleApp::Application.configure