Invoke HashWithIndifferentAccess#to_hash to cast to a hash since #to_h is not defined on Ruby19 and lower
This commit is contained in:
parent
08d89bdd5a
commit
abdf53ab39
|
@ -294,7 +294,7 @@ module PaperTrail
|
||||||
def changes_for_paper_trail
|
def changes_for_paper_trail
|
||||||
self.changes.delete_if do |key, value|
|
self.changes.delete_if do |key, value|
|
||||||
!notably_changed.include?(key)
|
!notably_changed.include?(key)
|
||||||
end.tap { |changes| self.class.serialize_attribute_changes(changes) }.to_h
|
end.tap { |changes| self.class.serialize_attribute_changes(changes) }.to_hash
|
||||||
end
|
end
|
||||||
|
|
||||||
# Invoked via`after_update` callback for when a previous version is reified and then saved
|
# Invoked via`after_update` callback for when a previous version is reified and then saved
|
||||||
|
|
|
@ -21,7 +21,7 @@ describe PaperTrail::Version, :type => :model do
|
||||||
specify { expect(PaperTrail.serializer).to be PaperTrail::Serializers::YAML }
|
specify { expect(PaperTrail.serializer).to be PaperTrail::Serializers::YAML }
|
||||||
|
|
||||||
it "should store out as a plain hash" do
|
it "should store out as a plain hash" do
|
||||||
expect(value =~ /ActiveSupport::HashWithIndifferentAccess/).to be_nil
|
expect(value =~ /HashWithIndifferentAccess/).to be_nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ describe PaperTrail::Version, :type => :model do
|
||||||
before(:all) { PaperTrail.serializer = PaperTrail::Serializers::JSON }
|
before(:all) { PaperTrail.serializer = PaperTrail::Serializers::JSON }
|
||||||
|
|
||||||
it "should store out as a plain hash" do
|
it "should store out as a plain hash" do
|
||||||
expect(value =~ /ActiveSupport::HashWithIndifferentAccess/).to be_nil
|
expect(value =~ /HashWithIndifferentAccess/).to be_nil
|
||||||
end
|
end
|
||||||
|
|
||||||
after(:all) { PaperTrail.serializer = PaperTrail::Serializers::YAML }
|
after(:all) { PaperTrail.serializer = PaperTrail::Serializers::YAML }
|
||||||
|
|
Loading…
Reference in New Issue