instance method
cache_attributes
Ruby on Rails 2.3.18
Since v2.2.3 Last seen in v2.3.18Available in: v2.2.3 v2.3.18
Signature
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.rb, line 115
def cache_attributes(*attribute_names)
attribute_names.each {|attr| cached_attributes << attr.to_s}
end
Defined in activerecord/lib/active_record/attribute_methods.rb line 115
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::AttributeMethods::ClassMethods