Sha256: 7c15094b887fbf4b55bc40406ccb9fe56e192a208fffe8173674db0810870964

Contents?: true

Size: 616 Bytes

Versions: 11

Compression:

Stored size: 616 Bytes

Contents

module CassandraObject
  module Dirty
    extend ActiveSupport::Concern
    include ActiveModel::Dirty

    module InstanceMethods
      def attributes_changed!(attributes)
        attributes.each do |attr_name|
          attribute_will_change!(attr_name)
        end
      end

      def save(options={})
        super.tap { changed_attributes.clear }
      end

      def write_attribute(name, value)
        name = name.to_s
        unless attribute_changed?(name)
          old = read_attribute(name)
          changed_attributes[name] = old if old != value
        end
        super
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
gotime-cassandra_object-0.9.1 lib/cassandra_object/dirty.rb
gotime-cassandra_object-0.9.0 lib/cassandra_object/dirty.rb
gotime-cassandra_object-0.8.7 lib/cassandra_object/dirty.rb
gotime-cassandra_object-0.8.6 lib/cassandra_object/dirty.rb
gotime-cassandra_object-0.8.5 lib/cassandra_object/dirty.rb
gotime-cassandra_object-0.8.4 lib/cassandra_object/dirty.rb
gotime-cassandra_object-0.8.3 lib/cassandra_object/dirty.rb
gotime-cassandra_object-0.8.2 lib/cassandra_object/dirty.rb
gotime-cassandra_object-0.8.1 lib/cassandra_object/dirty.rb
gotime-cassandra_object-0.8.0 lib/cassandra_object/dirty.rb
gotime-cassandra_object-0.7.8 lib/cassandra_object/dirty.rb