diff options
author | Sean Griffin <sean@thoughtbot.com> | 2014-06-06 09:43:09 -0600 |
---|---|---|
committer | Sean Griffin <sean@thoughtbot.com> | 2014-06-07 07:03:42 -0600 |
commit | 2dca1ba039eb0d1adad089134749a5093b481666 (patch) | |
tree | 7ffd41b412443ed83fc9ea112fe196b48d0b8490 /activerecord/test/cases/serialized_attribute_test.rb | |
parent | ecd4151aa829214c7b10f24bc5eca194089b4319 (diff) | |
download | rails-2dca1ba039eb0d1adad089134749a5093b481666.tar.gz rails-2dca1ba039eb0d1adad089134749a5093b481666.tar.bz2 rails-2dca1ba039eb0d1adad089134749a5093b481666.zip |
Don't query the database schema when calling `serialize`
We need to decorate the types lazily. This is extracted to a separate
API, as there are other refactorings that will be able to make use of
it, and to allow unit testing the finer points more granularly.
Diffstat (limited to 'activerecord/test/cases/serialized_attribute_test.rb')
-rw-r--r-- | activerecord/test/cases/serialized_attribute_test.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/activerecord/test/cases/serialized_attribute_test.rb b/activerecord/test/cases/serialized_attribute_test.rb index debb227303..7d1c240638 100644 --- a/activerecord/test/cases/serialized_attribute_test.rb +++ b/activerecord/test/cases/serialized_attribute_test.rb @@ -14,6 +14,13 @@ class SerializedAttributeTest < ActiveRecord::TestCase Topic.serialize("content") end + def test_serialize_does_not_eagerly_load_columns + assert_no_queries do + Topic.reset_column_information + Topic.serialize(:content) + end + end + def test_list_of_serialized_attributes assert_equal %w(content), Topic.serialized_attributes.keys end |