aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorSean Griffin <sean@seantheprogrammer.com>2017-01-03 16:12:46 -0500
committerGitHub <noreply@github.com>2017-01-03 16:12:46 -0500
commit95962c4fe0d09976e90cf7e179a72085a29812a7 (patch)
treec9d5d943dd37d2273405d3c9cbd3d3278a04c523 /activerecord/lib
parent769b25af588d87e4570c6b454990118ab432a3aa (diff)
parent8ded825bc29338d1a2ae7c3a2119cfa301008f85 (diff)
downloadrails-95962c4fe0d09976e90cf7e179a72085a29812a7.tar.gz
rails-95962c4fe0d09976e90cf7e179a72085a29812a7.tar.bz2
rails-95962c4fe0d09976e90cf7e179a72085a29812a7.zip
Merge pull request #27517 from maclover7/jm-fix-27502
Compare deserialized values for `PostgreSQL::OID::Hstore` types
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql/oid/hstore.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid/hstore.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid/hstore.rb
index d629ebca91..49dd4fc73f 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql/oid/hstore.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/hstore.rb
@@ -35,6 +35,14 @@ module ActiveRecord
ActiveRecord::Store::StringKeyedHashAccessor
end
+ # Will compare the Hash equivalents of +raw_old_value+ and +new_value+.
+ # By comparing hashes, this avoids an edge case where the order of
+ # the keys change between the two hashes, and they would not be marked
+ # as equal.
+ def changed_in_place?(raw_old_value, new_value)
+ deserialize(raw_old_value) != new_value
+ end
+
private
HstorePair = begin