我有一个愚蠢的问题。我有一些模型:
class Contractor < User
has_many :contractorEs
has_many :customers
end
class Customer < User
belongs_to :contractor
has_many :customerEs
end
当我尝试
c = Contractor.first
c.customers.build
我有ActiveRecord::UnknownAttributeError: unknown attribute: contractor_id
但我有迁移
class AddContractorIdToCustomers < ActiveRecord::Migration
def change
add_column :customers, :contractor_id, :integer
end
end
问题出在哪里?
编辑:是的,我运行迁移并尝试重新启动服务器。