Module: TrackChanges::ClassMethods

Defined in:
lib/track_changes/track_changes.rb

Instance Method Summary collapse

Instance Method Details

#track_changes_fieldsObject

Returns the method names to call to fetch the fields tracked for changes



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

def track_changes_fields
  fields =  Array(track_changes_options[:only]).collect(&:to_s).presence || self.attribute_names
  fields -= Array(track_changes_options[:except]).collect(&:to_s)
  fields += Array(track_changes_options[:methods]).collect(&:to_s)
  fields -= ['created_at', 'updated_at'] unless track_changes_options[:track_timestamps]
  fields -= [primary_key] unless track_changes_options[:track_primary_key]
end