diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2012-02-09 12:08:07 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2012-02-09 12:08:07 -0800 |
commit | f26fcc05f605caaa120db6af4c0e908cf8eb20c9 (patch) | |
tree | d0b88bbd5572be70994d20119f1dd8815291b659 | |
parent | f86b19842620301b969a4a264c97e5e6ebc7b67f (diff) | |
download | rails-f26fcc05f605caaa120db6af4c0e908cf8eb20c9.tar.gz rails-f26fcc05f605caaa120db6af4c0e908cf8eb20c9.tar.bz2 rails-f26fcc05f605caaa120db6af4c0e908cf8eb20c9.zip |
only exclude serialized columns from cacheable columns
-rw-r--r-- | activerecord/lib/active_record/attribute_methods/read.rb | 6 | ||||
-rw-r--r-- | activerecord/test/cases/attribute_methods_test.rb | 2 |
2 files changed, 6 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/attribute_methods/read.rb b/activerecord/lib/active_record/attribute_methods/read.rb index 88c81b2e01..0724082a2d 100644 --- a/activerecord/lib/active_record/attribute_methods/read.rb +++ b/activerecord/lib/active_record/attribute_methods/read.rb @@ -88,7 +88,11 @@ module ActiveRecord private def cacheable_column?(column) - attribute_types_cached_by_default.include?(column.type) + if attribute_types_cached_by_default == ATTRIBUTE_TYPES_CACHED_BY_DEFAULT + ! serialized_attributes.include? column.name + else + attribute_types_cached_by_default.include?(column.type) + end end def internal_attribute_access_code(attr_name, cast_code) diff --git a/activerecord/test/cases/attribute_methods_test.rb b/activerecord/test/cases/attribute_methods_test.rb index d6de668a17..e054980531 100644 --- a/activerecord/test/cases/attribute_methods_test.rb +++ b/activerecord/test/cases/attribute_methods_test.rb @@ -776,7 +776,7 @@ class AttributeMethodsTest < ActiveRecord::TestCase end def time_related_columns_on_topic - Topic.columns.select { |c| c.type.in?([:time, :date, :datetime, :timestamp]) } + Topic.columns.select { |c| [:time, :date, :datetime, :timestamp].include?(c.type) } end def in_time_zone(zone) |