Skip to content

Commit

Permalink
Merge branch 'jlxw-patch-2'
Browse files Browse the repository at this point in the history
Closes #9184
  • Loading branch information
rafaelfranca committed Mar 23, 2013
2 parents 31388fa + 2c93048 commit e96fa89
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Expand Up @@ -30,8 +30,8 @@ def string_to_hstore(string)
nil nil
elsif String === string elsif String === string
Hash[string.scan(HstorePair).map { |k,v| Hash[string.scan(HstorePair).map { |k,v|
v = v.upcase == 'NULL' ? nil : v.gsub(/^"(.*)"$/,'\1').gsub(/\\(.)/, '\1') v = v.upcase == 'NULL' ? nil : v.gsub(/\A"(.*)"\Z/m,'\1').gsub(/\\(.)/, '\1')
k = k.gsub(/^"(.*)"$/,'\1').gsub(/\\(.)/, '\1') k = k.gsub(/\A"(.*)"\Z/m,'\1').gsub(/\\(.)/, '\1')
[k,v] [k,v]
}] }]
else else
Expand Down
4 changes: 4 additions & 0 deletions activerecord/test/cases/adapters/postgresql/hstore_test.rb
Expand Up @@ -189,6 +189,10 @@ def test_quoting_special_characters
assert_cycle('ca' => 'cà', 'ac' => 'àc') assert_cycle('ca' => 'cà', 'ac' => 'àc')
end end


def test_multiline
assert_cycle("a\nb" => "c\nd")
end

private private
def assert_cycle hash def assert_cycle hash
# test creation # test creation
Expand Down

0 comments on commit e96fa89

Please sign in to comment.