Module: CouchRest::Model::Dirty

Extended by:
ActiveSupport::Concern
Includes:
ActiveModel::Dirty
Included in:
Base, CastedArray, CastedHash
Defined in:
lib/couchrest/model/dirty.rb

Overview

This applies to both Model::Base and Model::CastedModel

Instance Method Summary collapse

Instance Method Details

#couchrest_attribute_will_change!(attr) ⇒ Object



27
28
29
30
31
# File 'lib/couchrest/model/dirty.rb', line 27

def couchrest_attribute_will_change!(attr)
  return if attr.nil? || !use_dirty?
  attribute_will_change!(attr)
  couchrest_parent_will_change!
end

#couchrest_parent_will_change!Object



33
34
35
# File 'lib/couchrest/model/dirty.rb', line 33

def couchrest_parent_will_change!
  casted_by.couchrest_attribute_will_change!(casted_by_property.name) if casted_by_property
end

#use_dirty?Boolean

Returns:

  • (Boolean)


22
23
24
25
# File 'lib/couchrest/model/dirty.rb', line 22

def use_dirty?
  doc = base_doc
  doc && !doc.disable_dirty
end