Module: ActiveAttr::Dirty

Extended by:
ActiveSupport::Concern
Includes:
ActiveModel::Dirty
Included in:
Syncano::ActiveRecord::Base
Defined in:
lib/active_attr/dirty.rb

Overview

Overwritting ActiveAttr::Dirty module

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#initialize(attributes = nil, options = {}) ⇒ Object

Overwritten constructor

Parameters:

  • attributes (Hash) (defaults to: nil)
  • options (Hash) (defaults to: {})


29
30
31
32
# File 'lib/active_attr/dirty.rb', line 29

def initialize(attributes = nil, options = {})
  super(attributes, options)
  (@changed_attributes || {}).clear unless new_record?
end

#saveObject

Overwritten save method



35
36
37
38
# File 'lib/active_attr/dirty.rb', line 35

def save
  @previously_changed = changes
  @changed_attributes.clear
end