ActiveModel::MissingAttributeError: can't write unknown attribute `ad_id' with FactoryGirl

后端 未结 4 755
抹茶落季
抹茶落季 2021-01-03 18:06

I have the following models:

class Ad < ActiveRecord::Base
  belongs_to :page

  has_one :image
  has_one :logo
end

class Page < ActiveRecord::Base
           


        
4条回答
  •  醉话见心
    2021-01-03 18:29

    If you are getting this error while running the specs, it may be the newly added field that are not migrated in the test environment. So migrate it in the test environment with the below command

    rake db:migrate db:test:prepare
    

提交回复
热议问题