Sha256: b824bcc1a10a62bb796fef46b7e6093cc70b8ab395b95f91a75a332e53a1827b

Contents?: true

Size: 625 Bytes

Versions: 4

Compression:

Stored size: 625 Bytes

Contents

# frozen_string_literal: true

class Acfs::Resource
  #
  # Thin wrapper around ActiveModel::Dirty
  #
  module Dirty
    extend ActiveSupport::Concern
    include ActiveModel::Dirty

    # @api private
    #
    def reset_changes
      clear_changes_information
    end

    # @api private
    #
    def save!(*)
      super.tap {|_| changes_applied }
    end

    # @api private
    #
    def loaded!
      reset_changes
      super
    end

    # @api private
    #
    def write_raw_attribute(name, value, opts = {})
      attribute_will_change!(name) if opts[:change].nil? || opts[:change]
      super
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
acfs-1.5.1 lib/acfs/resource/dirty.rb
acfs-1.5.0 lib/acfs/resource/dirty.rb
acfs-1.4.0 lib/acfs/resource/dirty.rb
acfs-1.3.4 lib/acfs/resource/dirty.rb