2
不能確定記錄沒有被保存..爲什麼記錄沒有被保存..該方法被正確調用,並且所有字段都存在,並且邏輯正確..這是我的型號代碼:當調用before_save動作時記錄不保存
class Mine < ActiveRecord::Base
belongs_to :shop
validates :merchant_id, presence: true
validates :auth_token, presence: true
before_save :assign_three_speed
private
def assign_three_speed
if CreateFulfillmentService::NON_US_MARKETPLACES.include?
(self.marketplace)
self.three_speed = false
else
self.three_speed = true
end
end
end
那麼這是超級瘋狂..我把一些記錄器,現在它保存??這是我現在的代碼:
def assign_three_speed
Rails.logger.info "What is self?? #{self.inspect}"
if CreateFulfillmentService::NON_US_MARKETPLACES.include?
(self.marketplace)
self.three_speed = false
else
self.three_speed = true
end
Rails.logger.info "Now what is self?? #{self.inspect}"
end