Sha256: d05f057468f490571d51d756de118682ac43fa52cc7c725c1a655a9f0b0eae46

Contents?: true

Size: 597 Bytes

Versions: 10

Compression:

Stored size: 597 Bytes

Contents

module Toy
  module DirtyStore
    extend ActiveSupport::Concern
    include ActiveModel::Dirty
    include Reloadable
    include Persistence
    include Querying

    def initialize_from_database(*)
      super

      @previously_changed = {}
      @changed_attributes.clear if @changed_attributes

      self
    end

    def reload
      super.tap do
        @previously_changed = {}
        @changed_attributes = {}
      end
    end

    def save(*)
      super.tap do
        @previously_changed = changes
        @changed_attributes.clear if @changed_attributes
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
toystore-0.13.1 lib/toy/dirty_store.rb
toystore-0.13.0 lib/toy/dirty_store.rb
toystore-0.12.0 lib/toy/dirty_store.rb
toystore-0.11.0 lib/toy/dirty_store.rb
toystore-0.10.4 lib/toy/dirty_store.rb
toystore-0.10.3 lib/toy/dirty_store.rb
toystore-0.10.2 lib/toy/dirty_store.rb
toystore-0.10.1 lib/toy/dirty_store.rb
toystore-0.10.0 lib/toy/dirty_store.rb
toystore-0.9.0 lib/toy/dirty_store.rb