无法写入未知属性错误

时间:2016-02-20 15:06:24

标签: ruby-on-rails

当我执行模型测试时,我得到了这个:

  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

0 个答案:

没有答案