Sha256: 331be543525a3c277a227d7d0f68429e2dca3f30720804c701816dff50d82c1a
Contents?: true
Size: 861 Bytes
Versions: 12
Compression:
Stored size: 861 Bytes
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 = {} end status 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
12 entries across 12 versions & 2 rubygems