Sha256: afa84012a11d422a7b79aeb5d4c765f61815c33e21331b5c81e906479033abbc

Contents?: true

Size: 632 Bytes

Versions: 1

Compression:

Stored size: 632 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!(**kwargs)
      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

1 entries across 1 versions & 1 rubygems

Version Path
acfs-2.0.0 lib/acfs/resource/dirty.rb