Class: AttributesHistory::HistorySaver

Inherits:
Object
  • Object
show all
Defined in:
lib/attributes_history/history_saver.rb

Instance Method Summary collapse

Constructor Details

#initialize(changed_object, history_attributes, history_model) ⇒ HistorySaver

Returns a new instance of HistorySaver.



5
6
7
8
9
# File 'lib/attributes_history/history_saver.rb', line 5

def initialize(changed_object, history_attributes, history_model)
  @object = changed_object
  @history_attributes = history_attributes
  @history_model = history_model
end

Instance Method Details

#save_if_neededObject



11
12
13
14
# File 'lib/attributes_history/history_saver.rb', line 11

def save_if_needed
  save_history_entry if ::AttributesHistory.enabled? &&
                        history_attributes_changed?
end