Method: ActiveRecord::AttributeMethods::Read::ClassMethods#cache_attributes
- Defined in:
- lib/active_record/attribute_methods/read.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).
18 19 20 |
# File '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 |