Sha256: def150431bf188e03a12ff288e46e5d8afbe5a79a4580315f93b5bb4df74be98

Contents?: true

Size: 607 Bytes

Versions: 1

Compression:

Stored size: 607 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(options={})
      super.tap do
        @previously_changed = changes
        @changed_attributes.clear if @changed_attributes
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
toystore-0.13.2 lib/toy/dirty_store.rb