aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2013-08-07 15:17:15 +0200
committerYves Senn <yves.senn@gmail.com>2013-08-08 07:27:30 +0200
commit5ac2341fab689344991b2a4817bd2bc8b3edac9d (patch)
tree6779faa675a2a2e9cad6fd2e0a94cc5674f9b1d1 /activerecord/test/cases
parent765b8aa05c2176ec8d12b623ffc3df330f4ea383 (diff)
downloadrails-5ac2341fab689344991b2a4817bd2bc8b3edac9d.tar.gz
rails-5ac2341fab689344991b2a4817bd2bc8b3edac9d.tar.bz2
rails-5ac2341fab689344991b2a4817bd2bc8b3edac9d.zip
cast hstore values on write to be consistent with reading from the db.
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/adapters/postgresql/hstore_test.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/hstore_test.rb b/activerecord/test/cases/adapters/postgresql/hstore_test.rb
index e434b4861c..f61f196c71 100644
--- a/activerecord/test/cases/adapters/postgresql/hstore_test.rb
+++ b/activerecord/test/cases/adapters/postgresql/hstore_test.rb
@@ -70,6 +70,13 @@ class PostgresqlHstoreTest < ActiveRecord::TestCase
Hstore.reset_column_information
end
+ def test_cast_value_on_write
+ x = Hstore.new tags: {"bool" => true, "number" => 5}
+ assert_equal({"bool" => "true", "number" => "5"}, x.tags)
+ x.save
+ assert_equal({"bool" => "true", "number" => "5"}, x.reload.tags)
+ end
+
def test_type_cast_hstore
assert @column