aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorSean Griffin <sean@thoughtbot.com>2014-06-17 14:16:21 -0600
committerSean Griffin <sean@thoughtbot.com>2014-06-17 14:16:21 -0600
commitd9812729c325006212ad0e0e1566cc76c072e709 (patch)
tree6a0fc1238eacbb6be98ff3e9b454c0568e83c7eb /activerecord/lib
parent63b347df427ed2189fac7e75e36a3a4b9f6c2a68 (diff)
downloadrails-d9812729c325006212ad0e0e1566cc76c072e709.tar.gz
rails-d9812729c325006212ad0e0e1566cc76c072e709.tar.bz2
rails-d9812729c325006212ad0e0e1566cc76c072e709.zip
Don't assume that Hstore columns have always changed
HStore columns come back from the database separated by a comma and a space, not just a comma. We need to mirror that behavior since we compare the two values. Also adds a regression test against JSON to ensure we don't have the same bug there.
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql/cast.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/cast.rb b/activerecord/lib/active_record/connection_adapters/postgresql/cast.rb
index bb54de05c8..8f6247c7d2 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql/cast.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql/cast.rb
@@ -8,7 +8,7 @@ module ActiveRecord
def hstore_to_string(object, array_member = false) # :nodoc:
if Hash === object
- string = object.map { |k, v| "#{escape_hstore(k)}=>#{escape_hstore(v)}" }.join(',')
+ string = object.map { |k, v| "#{escape_hstore(k)}=>#{escape_hstore(v)}" }.join(', ')
string = escape_hstore(string) if array_member
string
else