Module: ChronoModel::TimeMachine::ClassMethods

Defined in:
lib/chrono_model/time_machine.rb

Instance Method Summary collapse

Instance Method Details

#attribute_names_for_history_changesObject



107
108
109
110
# File 'lib/chrono_model/time_machine.rb', line 107

def attribute_names_for_history_changes
  @attribute_names_for_history_changes ||= attribute_names -
                                           %w[id hid validity recorded_at]
end

#has_timeline(options) ⇒ Object



112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/chrono_model/time_machine.rb', line 112

def has_timeline(options)
  changes = options.delete(:changes)
  assocs  = history.has_timeline(options)

  attributes =
    if changes.present?
      Array.wrap(changes)
    else
      assocs.map(&:name)
    end

  attribute_names_for_history_changes.concat(attributes.map(&:to_s))
end

#history?Boolean

Identify this class as the parent, non-history, class.

Returns:

  • (Boolean)


99
100
101
# File 'lib/chrono_model/time_machine.rb', line 99

def history?
  false
end