instance method cache_attributes

Ruby on Rails 3.0.20

Since v3.0.20 Last seen in v4.1.16

Available in: v3.0.20 v3.1.12 v3.2.22.5 v4.0.13 v4.1.16

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_names rest
Source
# File activerecord/lib/active_record/attribute_methods/read.rb, line 22
        def cache_attributes(*attribute_names)
          attribute_names.each {|attr| cached_attributes << attr.to_s}
        end

Defined in activerecord/lib/active_record/attribute_methods/read.rb line 22 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveRecord::AttributeMethods::Read::ClassMethods

Type at least 2 characters to search.

↑↓ navigate · open · esc close