1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge branch 'jlxw-patch-2'

Closes #9184
This commit is contained in:
Rafael Mendonça França 2013-03-23 19:06:01 -03:00
commit e96fa8987b
2 changed files with 6 additions and 2 deletions

View file

@ -30,8 +30,8 @@ module ActiveRecord
nil
elsif String === string
Hash[string.scan(HstorePair).map { |k,v|
v = v.upcase == 'NULL' ? nil : v.gsub(/^"(.*)"$/,'\1').gsub(/\\(.)/, '\1')
k = k.gsub(/^"(.*)"$/,'\1').gsub(/\\(.)/, '\1')
v = v.upcase == 'NULL' ? nil : v.gsub(/\A"(.*)"\Z/m,'\1').gsub(/\\(.)/, '\1')
k = k.gsub(/\A"(.*)"\Z/m,'\1').gsub(/\\(.)/, '\1')
[k,v]
}]
else

View file

@ -189,6 +189,10 @@ class PostgresqlHstoreTest < ActiveRecord::TestCase
assert_cycle('ca' => 'cà', 'ac' => 'àc')
end
def test_multiline
assert_cycle("a\nb" => "c\nd")
end
private
def assert_cycle hash
# test creation