Sha256: 2da54454a9482fd1b14fb53e80c4925f7ce4d572df5ab827d547fe5b88c8d04a
Contents?: true
Size: 1.08 KB
Versions: 21
Compression:
Stored size: 1.08 KB
Contents
module CassandraObject module AttributeMethods module Dirty extend ActiveSupport::Concern include ActiveModel::Dirty # Attempts to +save+ the record and clears changed attributes if successful. def save(*) #:nodoc: if status = super @previously_changed = changes @changed_attributes.clear end status end # Attempts to <tt>save!</tt> the record and clears changed attributes if successful. def save!(*) #:nodoc: super.tap do @previously_changed = changes @changed_attributes.clear end end # <tt>reload</tt> the record and clears changed attributes. def reload super.tap do @previously_changed.try :clear @changed_attributes.try :clear end end def write_attribute(name, value) name = name.to_s old = read_attribute(name) super unless attribute_changed?(name) || old == read_attribute(name) changed_attributes[name] = old end end end end end
Version data entries
21 entries across 21 versions & 2 rubygems