Module: ActsAsTrackable::InstanceMethods

Defined in:
lib/trackable/acts_as_trackable.rb

Instance Method Summary collapse

Instance Method Details

#record_eventsObject



22
23
24
25
26
27
28
29
# File 'lib/trackable/acts_as_trackable.rb', line 22

def record_events
  active_keys = changes.keys.reject{ |key| %w{id created_at updated_at}.include?(key)}
  active_keys.map do |key|
    old_val, new_val = changes[key]
    attrs = Event.attributes_from(self, key, old_val, new_val)
    events.create(attrs) if attrs
  end
end