Module: CouchPotato::Persistence::DirtyAttributes
- Defined in:
- lib/couch_potato/persistence/dirty_attributes.rb
Class Method Summary (collapse)
-
+ (Object) included(base)
:nodoc:.
Instance Method Summary (collapse)
-
- (Boolean) dirty?
returns true if a model has dirty attributes, i.e.
- - (Object) initialize(attributes = {})
-
- (Object) is_dirty
marks a model as dirty.
Class Method Details
+ (Object) included(base)
: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
- (Boolean) dirty?
returns true if a model has dirty attributes, i.e. their value has changed since the last save
18 19 20 |
# File 'lib/couch_potato/persistence/dirty_attributes.rb', line 18 def dirty? changed? || @forced_dirty end |
- (Object) initialize(attributes = {})
13 14 15 |
# File 'lib/couch_potato/persistence/dirty_attributes.rb', line 13 def initialize(attributes = {}) super end |
- (Object) is_dirty
marks a model as dirty
23 24 25 |
# File 'lib/couch_potato/persistence/dirty_attributes.rb', line 23 def is_dirty @forced_dirty = true end |