提交 1e2ab564 编写于 作者: A Aaron Patterson

fewer funcalls to the cached attributes variable

上级 63ed6ca9
...@@ -20,7 +20,7 @@ module ClassMethods ...@@ -20,7 +20,7 @@ module ClassMethods
# be cached. Usually caching only pays off for attributes with expensive conversion # be cached. Usually caching only pays off for attributes with expensive conversion
# methods, like time related columns (e.g. +created_at+, +updated_at+). # methods, like time related columns (e.g. +created_at+, +updated_at+).
def cache_attributes(*attribute_names) def cache_attributes(*attribute_names)
attribute_names.each {|attr| cached_attributes << attr.to_s} cached_attributes.merge attribute_names.map { |attr| attr.to_s }
end end
# Returns the attributes which are cached. By default time related columns # Returns the attributes which are cached. By default time related columns
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册