Sha256: c06b1260653d1eed40e3e00bd6ce2fac120d96e7973cc421b53e186fadbbda30
Contents?: true
Size: 996 Bytes
Versions: 2
Compression:
Stored size: 996 Bytes
Contents
module CassandraObject 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.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
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
gotime-cassandra_object-2.7.0 | lib/cassandra_object/dirty.rb |
gotime-cassandra_object-2.6.4 | lib/cassandra_object/dirty.rb |