Module: TrackHistory::HistoricalRelationHelpers

Defined in:
lib/track_history/historical_relation_helpers.rb

Instance Method Summary collapse

Instance Method Details

#modificationsObject

Get a list of the modifications in a given history



6
7
8
9
10
# File 'lib/track_history/historical_relation_helpers.rb', line 6

def modifications
  self.class.historical_fields.reject do |field, options|
    send(options[:before]) == send(options[:after])
  end.keys
end

#to_sObject



12
13
14
15
16
17
# File 'lib/track_history/historical_relation_helpers.rb', line 12

def to_s
  return 'modified nothing' if modifications.empty?
  str = 'modified ' + modifications.sort.join(', ')
  str += " on #{historical_relation}" if self.class.instance_variable_get(:@track_historical_reference)
  str
end