Module: CouchPotato::Persistence::DirtyAttributes
- Defined in:
- lib/couch_potato/persistence/dirty_attributes.rb
Class Method Summary collapse
-
.included(base) ⇒ Object
:nodoc:.
Instance Method Summary collapse
-
#dirty? ⇒ Boolean
returns true if a model has dirty attributes, i.e.
-
#is_dirty ⇒ Object
marks a model as dirty.
Class Method Details
.included(base) ⇒ Object
:nodoc:
6 7 8 9 10 11 |
# File 'lib/couch_potato/persistence/dirty_attributes.rb', line 6 def self.included(base) #:nodoc: base.send :include, ActiveModel::Dirty 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
14 15 16 |
# File 'lib/couch_potato/persistence/dirty_attributes.rb', line 14 def dirty? changed? || @forced_dirty end |
#is_dirty ⇒ Object
marks a model as dirty
19 20 21 |
# File 'lib/couch_potato/persistence/dirty_attributes.rb', line 19 def is_dirty @forced_dirty = true end |