Module: ActAsDirty::ActiveRecord::Cleans

Extended by:
ActiveSupport::Concern
Includes:
ActAsDirty::ActiveModel::Cleans
Defined in:
lib/act_as_dirty/active_record/cleans.rb

Instance Method Summary collapse

Methods included from ActAsDirty::ActiveModel::Cleans

#dirt, #read_changes_for_cleaning

Instance Method Details

#clean?(context = nil) ⇒ Boolean

Returns:

  • (Boolean)


12
13
14
15
16
# File 'lib/act_as_dirty/active_record/cleans.rb', line 12

def clean?(context = nil)
  context ||= (new_record? ? :create : :update)
  output = super(context)
  dirt.empty? && output
end

#dirty?(context = nil) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/act_as_dirty/active_record/cleans.rb', line 18

def dirty?(context = nil)
  !clean?(context)
end

#save(options = {}) ⇒ Object



7
8
9
10
# File 'lib/act_as_dirty/active_record/cleans.rb', line 7

def save(options={})
  perform_cleanings(options)
  super
end