gpt4 book ai didi

ruby-on-rails - heroku部署上的迁移错误

转载 作者:行者123 更新时间:2023-12-04 05:52:59 25 4
gpt4 key购买 nike

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)

最佳答案

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

config.active_record.dump_schema_after_migration = false

关于ruby-on-rails - heroku部署上的迁移错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25564012/

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