我有以下两种型号: class Offer < ApplicationRecordend
belongs_to:offer
end 当我尝试在没有offer_id的情况下保存Booking对象时,Rails抛出一个验证错误"Offer is required“。但是我不会主动验证关联对象的存在(我打算稍后为这个关联添加一个条件验证)
我正在从Rails 4.2升级到6,我还使用了FactoryBot 6.2.0。我有这个型号 belongs_to :author, inverse_of: :book validates :model}describe Book do
it { should belong_to :author }
但是,看来“验证”方法