From 6d39d05269fa0f07ab86195e8a09320f63ac9dbb Mon Sep 17 00:00:00 2001 From: Michael Koziarski Date: Fri, 1 Feb 2008 23:15:57 +0000 Subject: Avoid Base#attributes when saving / creating records. Closes #10978 [adymo] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8770 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/lib/active_record/base.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'activerecord/lib/active_record') diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index dfde2e6e1d..6cf5957027 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -2426,11 +2426,11 @@ module ActiveRecord #:nodoc: # Returns a copy of the attributes hash where all the values have been safely quoted for use in # an SQL statement. def attributes_with_quotes(include_primary_key = true, include_readonly_attributes = true) - quoted = attributes.inject({}) do |result, (name, value)| + quoted = {} + @attributes.each_pair do |name, value| if column = column_for_attribute(name) - result[name] = quote_value(value, column) unless !include_primary_key && column.primary + quoted[name] = quote_value(read_attribute(name), column) unless !include_primary_key && column.primary end - result end include_readonly_attributes ? quoted : remove_readonly_attributes(quoted) end -- cgit v1.2.3