当我执行模型测试时,我得到了这个:
Failure/Error: sms_payment = create(:sms_payment)
ActiveModel::MissingAttributeError:
can't write unknown attribute `paid_parking_id`
我仔细检查过:迁移已经完成,我在架构中已经完成了:
create_table "sms_payments", force: :cascade do |t|
#...
t.integer "paid_parking_id"
end
我的模特:
belongs_to :paid_parking
厂:
FactoryGirl.define do
factory :sms_payment do
#...
paid_parking
end
end