lib/active_archive/base.rb in active_archive-5.2.1 vs lib/active_archive/base.rb in active_archive-5.2.2
- old
+ new
@@ -1,7 +1,9 @@
# frozen_string_literal: true
+# require "active_record/attribute_mutation_tracker"
+
module ActiveArchive
module Base
def self.included(base)
base.extend Methods
@@ -85,14 +87,14 @@
begin
should_ignore_validations?(force) ? record.save(validate: false) : record.save!
if ::ActiveRecord::VERSION::MAJOR >= 5 && ::ActiveRecord::VERSION::MINOR >= 2
- # TODO
- elsif ::ActiveRecord::VERSION::MAJOR >= 5
+ @attributes_changed_by_setter = record.send(:saved_changes)
+ elsif ::ActiveRecord::VERSION::MAJOR >= 5 && ::ActiveRecord::VERSION::MINOR >= 1
@changed_attributes = record.send(:saved_changes)
- @previous_mutation_tracker = record.send(:previous_mutation_tracker)
- @mutation_tracker = nil
+ elsif ::ActiveRecord::VERSION::MAJOR >= 5 && ::ActiveRecord::VERSION::MINOR >= 0
+ @changed_attributes = record.send(:previous_changes)
elsif ::ActiveRecord::VERSION::MAJOR >= 4
@previously_changed = record.instance_variable_get('@previously_changed')
end
@attributes = record.instance_variable_get('@attributes')