Module: Historical::ActiveRecord::Extensions::InstanceMethods

Defined in:
lib/historical/active_record.rb

Instance Method Summary collapse

Instance Method Details

#historyModelHistory

Returns The history of this model.

Returns:



48
49
50
# File 'lib/historical/active_record.rb', line 48

def history
  @history ||= Historical::ModelHistory.new(self)
end

#invalidate_history!Object

Invalidates the history of that model



59
60
61
# File 'lib/historical/active_record.rb', line 59

def invalidate_history!
  @history = nil
end

#versionInteger

Returns The version number of this model.

Returns:

  • (Integer)

    The version number of this model



53
54
55
# File 'lib/historical/active_record.rb', line 53

def version
  historical_version || history.own_version.version_index
end