diff options
author | Yves Senn <yves.senn@gmail.com> | 2013-08-07 15:17:15 +0200 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2013-08-08 07:27:30 +0200 |
commit | 5ac2341fab689344991b2a4817bd2bc8b3edac9d (patch) | |
tree | 6779faa675a2a2e9cad6fd2e0a94cc5674f9b1d1 /activerecord/test/cases | |
parent | 765b8aa05c2176ec8d12b623ffc3df330f4ea383 (diff) | |
download | rails-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.rb | 7 |
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 |