aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorJoel <joel@renewfund.com>2012-02-08 14:21:10 -0800
committerJoel <joel@renewfund.com>2012-02-08 22:28:51 -0800
commit2dd0178229ccd5e7f19f120ded85fd4a80306cac (patch)
treebbde2521a8d7ed9848acba1b814054ad719a7bd7 /activerecord/test
parent5b318a84e79d9b0a8276b382d076920befa03ca8 (diff)
downloadrails-2dd0178229ccd5e7f19f120ded85fd4a80306cac.tar.gz
rails-2dd0178229ccd5e7f19f120ded85fd4a80306cac.tar.bz2
rails-2dd0178229ccd5e7f19f120ded85fd4a80306cac.zip
Also support writing the hstore back to the database
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/adapters/postgresql/hstore_test.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/hstore_test.rb b/activerecord/test/cases/adapters/postgresql/hstore_test.rb
index 82c52b38a3..1644a58d92 100644
--- a/activerecord/test/cases/adapters/postgresql/hstore_test.rb
+++ b/activerecord/test/cases/adapters/postgresql/hstore_test.rb
@@ -86,6 +86,14 @@ class PostgresqlHstoreTest < ActiveRecord::TestCase
assert_equal({"\"a"=>"q\"w"}, @column.type_cast('\"a=>q"w'))
end
+ def test_rewrite
+ @connection.execute "insert into hstores (tags) VALUES ('1=>2')"
+ x = Hstore.find :first
+ x.tags = { '"a\'' => 'b' }
+ assert x.save!
+ end
+
+
def test_select
@connection.execute "insert into hstores (tags) VALUES ('1=>2')"
x = Hstore.find :first