lib/historic/historic.rb in historic-0.1.0 vs lib/historic/historic.rb in historic-0.2.0
- old
+ new
@@ -37,10 +37,11 @@
#
def historic_extract_options(options)
@historic_record_class = (options.delete(:class_name) || "#{self.to_s}History").constantize
options[:on_change_of] = [options[:on_change_of]] if options[:on_change_of] && !options[:on_change_of].is_a?(Array)
+ options[:version_column] ||= :version
@historic_options = options
end
end #ClassMethods
@@ -52,9 +53,12 @@
def before_save_with_historic
before_save_without_historic
if historic_should_move_to_history?(historic_options)
historic_copy_to_history
+ if self.respond_to?(historic_options[:version_column])
+ self.increment(historic_options[:version_column])
+ end
end
end
# Chain historic_copy_to_history into before_destroy.
#
\ No newline at end of file