diff options
author | Michael Koziarski <michael@koziarski.com> | 2008-02-14 20:09:05 +0000 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2008-02-14 20:09:05 +0000 |
commit | c75abf058eb300e066ce96960ad27f1433869524 (patch) | |
tree | 2409870484875b3a61c5b368b39a18516f5fb2de /activerecord/lib/active_record/base.rb | |
parent | 838b02450ad3308c02a347d5f274b530f7a4a161 (diff) | |
download | rails-c75abf058eb300e066ce96960ad27f1433869524.tar.gz rails-c75abf058eb300e066ce96960ad27f1433869524.tar.bz2 rails-c75abf058eb300e066ce96960ad27f1433869524.zip |
Avoid repeated calls to Base#connection. Closes #11111 [adymo]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8871 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record/base.rb')
-rwxr-xr-x | activerecord/lib/active_record/base.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 94ff704b25..481214c23c 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -2417,9 +2417,10 @@ module ActiveRecord #:nodoc: # an SQL statement. def attributes_with_quotes(include_primary_key = true, include_readonly_attributes = true) quoted = {} + connection = self.class.connection @attributes.each_pair do |name, value| if column = column_for_attribute(name) - quoted[name] = quote_value(read_attribute(name), column) unless !include_primary_key && column.primary + quoted[name] = connection.quote(read_attribute(name), column) unless !include_primary_key && column.primary end end include_readonly_attributes ? quoted : remove_readonly_attributes(quoted) @@ -2529,8 +2530,9 @@ module ActiveRecord #:nodoc: end def quoted_column_names(attributes = attributes_with_quotes) + connection = self.class.connection attributes.keys.collect do |column_name| - self.class.connection.quote_column_name(column_name) + connection.quote_column_name(column_name) end end |