From 1e2ab564f9680fe8ac4fbd55c36eb420f46498e6 Mon Sep 17 00:00:00 2001
From: Aaron Patterson <aaron.patterson@gmail.com>
Date: Fri, 7 Jan 2011 16:00:05 -0800
Subject: fewer funcalls to the cached attributes variable

---
 activerecord/lib/active_record/attribute_methods/read.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/activerecord/lib/active_record/attribute_methods/read.rb b/activerecord/lib/active_record/attribute_methods/read.rb
index 506f6e878f..2001b6522d 100644
--- a/activerecord/lib/active_record/attribute_methods/read.rb
+++ b/activerecord/lib/active_record/attribute_methods/read.rb
@@ -20,7 +20,7 @@ module ActiveRecord
         # be cached. Usually caching only pays off for attributes with expensive conversion
         # methods, like time related columns (e.g. +created_at+, +updated_at+).
         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
 
         # Returns the attributes which are cached. By default time related columns
-- 
cgit v1.2.3