Module: CouchPotato::Persistence::DirtyAttributes

Defined in:
lib/couch_potato/persistence/dirty_attributes.rb

Class Method Summary (collapse)

Instance Method Summary (collapse)

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



14
15
16
# File 'lib/couch_potato/persistence/dirty_attributes.rb', line 14

def dirty?
  changed? || @forced_dirty
end

- (Object) is_dirty

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