Method: Hist::ApplicationRecord#without_persisting
- Defined in:
- app/models/hist/application_record.rb
#without_persisting(record) ⇒ Object
From: github.com/westonganger/paper_trail-association_tracking/blob/5ed8cfbfa48cc773cc8a694dabec5a962d9c6cfe/lib/paper_trail_association_tracking/reifiers/has_one.rb Temporarily suppress #save so we can reassociate with the reified master of a has_one relationship. Since ActiveRecord 5 the related object is saved when it is assigned to the association. ActiveRecord 5 also happens to be the first version that provides #suppress.
328 329 330 331 332 333 334 |
# File 'app/models/hist/application_record.rb', line 328 def without_persisting(record) if record.class.respond_to? :suppress record.class.suppress { yield } else yield end end |