instance method
cache_attributes
Ruby on Rails 4.0.13
Since v3.0.20 Last seen in v4.1.16Signature
cache_attributes(*attribute_names)
cache_attributes allows you to declare which converted attribute values should be cached. Usually caching only pays off for attributes with expensive conversion methods, like time related columns (e.g. created_at, updated_at).
Parameters
-
attribute_namesrest
Source
# File activerecord/lib/active_record/attribute_methods/read.rb, line 18
def cache_attributes(*attribute_names)
cached_attributes.merge attribute_names.map { |attr| attr.to_s }
end
Defined in activerecord/lib/active_record/attribute_methods/read.rb line 18
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::AttributeMethods::Read::ClassMethods