Sha256: 18e5f2c5e8f279c15509fc6f35ea454382856b457c6ec72690bc0aaf9d41f737
Contents?: true
Size: 640 Bytes
Versions: 6
Compression:
Stored size: 640 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) @attributes ||= {} name = name.to_s current = read_attribute(name) attribute_will_change!(name) if current != value super end end end
Version data entries
6 entries across 6 versions & 1 rubygems