【发布时间】:2017-11-12 01:27:05
【问题描述】:
我刚刚完成了我的第一个 Ruby on Rails 应用程序,我正在尝试将它部署到 Heroku。我现在处于最后一步,但是当我运行以下命令(heroku run rake db:migrate)时,我收到了这个错误:
StandardError : Directly inheriting from ActiveRecord::Migration is not supported.
Please specify the Rails release the migration was written for.
网络上的每个人都说你只需要改变
class CreateRelationships < ActiveRecord::Migration
到
class CreateRelationships < ActiveRecord::Migration[4.2]
问题是这个解决方案对我不起作用。提前谢谢!
【问题讨论】:
-
您使用的是什么版本的rails(我假设是4.2.x)?您是否更新了所有迁移?
-
是的,我使用 Rails 4.2 并更新了所有迁移...
-
这是一个 rails 5 错误,所以 heroku 认为你有 rails 5,我猜这不会在本地发生。您在 gemfile 中的确切版本是什么?
标签: ruby-on-rails ruby heroku activerecord migration