Sha256: eeec5d7850abefc4a316f5853936ab75c60f9a9b3491eb88be7b0859470f770e
Contents?: true
Size: 599 Bytes
Versions: 40
Compression:
Stored size: 599 Bytes
Contents
# Keeps the #persisted? property synced with the model's. module Disposable::Twin::Persisted def self.included(includer) includer.send(:property, :persisted?, writeable: false) end def save!(*) super.tap do send "persisted?=", model.persisted? end end def created? # when the persisted field got flipped, this means creation! changed?(:persisted?) end # DISCUSS: i did not add #updated? on purpose. while #created's semantic is clear, #updated is confusing. # does it include change, etc. i leave this up to the user until we have a clear definition. end
Version data entries
40 entries across 40 versions & 1 rubygems