mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
commit
e96fa8987b
2 changed files with 6 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue