Module: LoadWithOriginalAttributes

Included in:
ActiveResource::Base
Defined in:
lib/esp/extensions/active_resource/dirty.rb

Instance Method Summary collapse

Instance Method Details

#load(attributes, _remove_root = false, persisted = false) ⇒ Object

After sending to the API the object is reloaded with its attributes The persisted flag tells us it has been saved



33
34
35
36
37
38
39
40
41
# File 'lib/esp/extensions/active_resource/dirty.rb', line 33

def load(attributes, _remove_root = false, persisted = false)
  if persisted
    super.tap do |object|
      object.original_attributes = object.attributes
    end
  else
    super
  end
end