From 2dca1ba039eb0d1adad089134749a5093b481666 Mon Sep 17 00:00:00 2001 From: Sean Griffin Date: Fri, 6 Jun 2014 09:43:09 -0600 Subject: 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. --- activerecord/test/cases/serialized_attribute_test.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'activerecord/test/cases/serialized_attribute_test.rb') 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 -- cgit v1.2.3