Module: CouchTomato::Persistence::DirtyAttributes
- Defined in:
- lib/couch_tomato/persistence/dirty_attributes.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#dirty? ⇒ Boolean
returns true if a model has dirty attributes, i.e.
Class Method Details
.included(base) ⇒ Object
5 6 7 8 9 |
# File 'lib/couch_tomato/persistence/dirty_attributes.rb', line 5 def self.included(base) base.class_eval do after_save :reset_dirty_attributes end end |
Instance Method Details
#dirty? ⇒ Boolean
returns true if a model has dirty attributes, i.e. their value has changed since the last save
12 13 14 15 16 |
# File 'lib/couch_tomato/persistence/dirty_attributes.rb', line 12 def dirty? new? || self.class.properties.inject(false) do |res, property| res || property.dirty?(self) end end |