Method: ActiveRecord::AttributeMethods::ClassMethods#cache_attributes
- Defined in:
- lib/active_record/attribute_methods.rb
#cache_attributes(*attribute_names) ⇒ Object
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).
113 114 115 |
# File 'lib/active_record/attribute_methods.rb', line 113 def cache_attributes(*attribute_names) attribute_names.each {|attr| cached_attributes << attr.to_s} end |