每当我尝试执行rake db:migrate时,它会停止迁移并出现以下错误:
uninitialized constant ModifySiteIdForSpudPermalinks::SpudPermalink
有问题的迁移文件是:
class ModifySiteIdForSpudPermalinks < ActiveRecord::Migration[4.2]
def up
change_column :spud_permalinks, :site_id, :integer, :default => 0, :null => false
SpudPermalink.where(:site_id => nil).each {|f| f.site_id = 0 ; f.save}
end
def down
change_column :spud_permalinks, :site_id, :integer, :default => nil, :null => true
SpudPermalink.where(:site_id => 0).each {|f| f.site_id = nil ; f.save}
end
end
我认为它可能是该版本的问题,但它仍然是5.1的问题。没有别的东西对我而言。有什么指导吗?