Sha256: 1ba5a0384ebc34b9aeda52351f2c2c4a3eef2346fdd0ad8e5844fdaa5a2c4717
Contents?: true
Size: 614 Bytes
Versions: 3
Compression:
Stored size: 614 Bytes
Contents
module Toy module Dirty extend ActiveSupport::Concern include ActiveModel::Dirty include Attributes include Cloneable def initialize(*) super # never register initial id assignment as a change @changed_attributes.delete('id') if @changed_attributes end def initialize_copy(*) super.tap do @previously_changed = {} @changed_attributes = {} end end def write_attribute(name, value) name = name.to_s current = read_attribute(name) attribute_will_change!(name) if current != value super end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
toystore-0.10.1 | lib/toy/dirty.rb |
toystore-0.10.0 | lib/toy/dirty.rb |
toystore-0.9.0 | lib/toy/dirty.rb |