Sha256: 0081a7e4e7e9f66052e13b51bd0c157f04cedac13b33a646f8b8e7ec3e5ef1ad
Contents?: true
Size: 1.07 KB
Versions: 70
Compression:
Stored size: 1.07 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
70 entries across 70 versions & 1 rubygems