diff options
author | Yves Senn <yves.senn@gmail.com> | 2014-05-28 13:32:40 +0200 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2014-05-28 13:35:02 +0200 |
commit | bdbf00dc78869f91a8af4d56a19213faf2b8d9e5 (patch) | |
tree | bb9e53068d5fb30ea7c038888d531d0673f1e7d6 /activerecord/test/cases/adapters/postgresql/hstore_test.rb | |
parent | 7f73b9152cfc3f218cfc862e971ba56b94f6be10 (diff) | |
download | rails-bdbf00dc78869f91a8af4d56a19213faf2b8d9e5.tar.gz rails-bdbf00dc78869f91a8af4d56a19213faf2b8d9e5.tar.bz2 rails-bdbf00dc78869f91a8af4d56a19213faf2b8d9e5.zip |
pg, keep `hstore` and `json` attributes as `Hash` in @attributes.
The solution presented in this patch is not efficient. We should replace it
in the near future. The following needs to be worked out:
* Is `@attributes` storing the Ruby or SQL representation?
* `cacheable_column?` is broken but `hstore` and `json` rely on that behavior
Refs #15369.
/cc @sgrif @rafaelfranca
Diffstat (limited to 'activerecord/test/cases/adapters/postgresql/hstore_test.rb')
-rw-r--r-- | activerecord/test/cases/adapters/postgresql/hstore_test.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/hstore_test.rb b/activerecord/test/cases/adapters/postgresql/hstore_test.rb index 67a610b459..1fef4899be 100644 --- a/activerecord/test/cases/adapters/postgresql/hstore_test.rb +++ b/activerecord/test/cases/adapters/postgresql/hstore_test.rb @@ -142,6 +142,16 @@ class PostgresqlHstoreTest < ActiveRecord::TestCase assert_equal "GMT", x.timezone end + def test_duplication_with_store_accessors + x = Hstore.new(language: "fr", timezone: "GMT") + assert_equal "fr", x.language + assert_equal "GMT", x.timezone + + y = x.dup + assert_equal "fr", y.language + assert_equal "GMT", y.timezone + end + def test_gen1 assert_equal(%q(" "=>""), @column.class.hstore_to_string({' '=>''})) end |