module DeltaChanges::Extension::ClassMethods
Public Instance Methods
define_virtual_attribute_delta_methods()
click to toggle source
Provide for delta tracking of virtual (non-column) attributes.
# File lib/delta_changes.rb, line 25 def define_virtual_attribute_delta_methods delta_changes_options[:attributes].each do |tracked_attribute| class_eval do define_method("#{tracked_attribute}_delta_changed?") do attribute_delta_changed?(tracked_attribute) end define_method("#{tracked_attribute}_delta_change") do attribute_delta_change(tracked_attribute) end define_method("#{tracked_attribute}_delta_was") do attribute_delta_was(tracked_attribute) end define_method("#{tracked_attribute}_delta_will_change!") do |*args| attribute_delta_will_change!(tracked_attribute, *args) end end end end
delta_changes(options)
click to toggle source
# File lib/delta_changes.rb, line 17 def delta_changes(options) self.delta_changes_options = options define_virtual_attribute_delta_methods end