heroku部署的迁移错误

时间:2014-08-29 07:59:26

标签: ruby-on-rails heroku

NoMethodError: undefined method `dump_schema_after_migration=' for ActiveRecord:
:Base:Class

$ heroku run rake db:migrate

我是heroku部署的新手并且无法解决它,请帮助解决它 提前谢谢。

这就是我实际得到的。

$ heroku run rake db:migrate

这是完整的错误跟踪:

Running `rake db:migrate` attached to terminal... up, run.4727
rake aborted!
NoMethodError: undefined method `dump_schema_after_migration=' for ActiveRecord:
:Base:Class
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.8/lib/active_record/dynamic_
matchers.rb:22:in `method_missing'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.8/lib/active_record/railtie.
rb:166:in `block (3 levels) in <class:Railtie>'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.8/lib/active_record/railtie.
rb:165:in `each'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.8/lib/active_record/railtie.
rb:165:in `block (2 levels) in <class:Railtie>'
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.8/lib/active_support/lazy_l
oad_hooks.rb:38:in `instance_eval'
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.8/lib/active_support/lazy_l
oad_hooks.rb:38:in `execute_hook'
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.8/lib/active_support/lazy_l
oad_hooks.rb:28:in `block in on_load'
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.8/lib/active_support/lazy_l
oad_hooks.rb:27:in `each'
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.8/lib/active_support/lazy_l
oad_hooks.rb:27:in `on_load'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.8/lib/active_record/railtie.
rb:114:in `block in <class:Railtie>'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.8/lib/rails/initializable.rb:30:
in `instance_exec'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.8/lib/rails/initializable.rb:30:
in `run'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.8/lib/rails/initializable.rb:55:
in `block in run_initializers'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.8/lib/rails/initializable.rb:54:
in `run_initializers'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.8/lib/rails/application.rb:215:i
n `initialize!'
/app/config/environment.rb:5:in `<top (required)>'
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.8/lib/active_support/depend
encies.rb:229:in `require'
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.8/lib/active_support/depend
encies.rb:229:in `block in require'
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.8/lib/active_support/depend
encies.rb:214:in `load_dependency'
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.8/lib/active_support/depend
encies.rb:229:in `require'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.8/lib/rails/application.rb:189:i
n `require_environment!'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.8/lib/rails/application.rb:250:i
n `block in run_tasks_blocks'
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)

1 个答案:

答案 0 :(得分:2)

假设您使用的是Rais 4,只需删除config/environments/production.rb

中的以下代码即可
config.active_record.dump_schema_after_migration = false