Module: Ardm::ActiveRecord::Dirty
- Included in:
- Base
- Defined in:
- lib/ardm/active_record/dirty.rb
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &block) ⇒ Object
16
17
18
19
20
21
22
|
# File 'lib/ardm/active_record/dirty.rb', line 16
def method_missing(meth, *args, &block)
if meth.to_s =~ /^([\w_]+)_dirty\?$/
send("#{$1}_changed?", *args, &block)
else
super
end
end
|
Instance Method Details
#dirty? ⇒ Boolean
4
5
6
|
# File 'lib/ardm/active_record/dirty.rb', line 4
def dirty?
changed?
end
|
#dirty_attributes ⇒ Object
8
9
10
11
12
13
14
|
# File 'lib/ardm/active_record/dirty.rb', line 8
def dirty_attributes
changes.inject({}) do |memo, (attr, val)|
property = properties[attr]
memo[property] = val
memo
end
end
|