diff options
author | Michael Koziarski <michael@koziarski.com> | 2008-02-01 23:15:57 +0000 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2008-02-01 23:15:57 +0000 |
commit | 6d39d05269fa0f07ab86195e8a09320f63ac9dbb (patch) | |
tree | 2e1714c128548b209a02713460f4e62b43150b8c | |
parent | 0d26e47b296e29dc48da1b31949d7b7adfb40553 (diff) | |
download | rails-6d39d05269fa0f07ab86195e8a09320f63ac9dbb.tar.gz rails-6d39d05269fa0f07ab86195e8a09320f63ac9dbb.tar.bz2 rails-6d39d05269fa0f07ab86195e8a09320f63ac9dbb.zip |
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
-rwxr-xr-x | activerecord/lib/active_record/base.rb | 6 |
1 files changed, 3 insertions, 3 deletions
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 |