diff options
author | Michael Koziarski <michael@koziarski.com> | 2008-02-11 21:02:17 +0000 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2008-02-11 21:02:17 +0000 |
commit | 873939013455135dfe751156c7f8c7ad6fbe6b59 (patch) | |
tree | 60805d9b70d2307edd020887d838272e76efe1dc /activerecord | |
parent | 081eed352fb7c16cbe1a18e13d032aa3512b04cd (diff) | |
download | rails-873939013455135dfe751156c7f8c7ad6fbe6b59.tar.gz rails-873939013455135dfe751156c7f8c7ad6fbe6b59.tar.bz2 rails-873939013455135dfe751156c7f8c7ad6fbe6b59.zip |
Avoid cloning in Base#attributes_before_typecast. Closes #11077 [juanjo.bazan]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8858 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord')
-rwxr-xr-x | activerecord/lib/active_record/base.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 642a7e2b96..cd33c8891c 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -2088,7 +2088,7 @@ module ActiveRecord #:nodoc: # The extent of a "deep" clone is application-specific and is therefore # left to the application to implement according to its need. def clone - attrs = self.attributes_before_type_cast + attrs = clone_attributes(:read_attribute_before_type_cast) attrs.delete(self.class.primary_key) record = self.class.new record.send :instance_variable_set, '@attributes', attrs @@ -2236,9 +2236,13 @@ module ActiveRecord #:nodoc: end end - # Returns a hash of cloned attributes before typecasting and deserialization. + # Returns a hash of attributes before typecasting and deserialization. def attributes_before_type_cast - clone_attributes :read_attribute_before_type_cast + attrs = {} + self.attribute_names.each do |name| + attrs[name]=read_attribute_before_type_cast(name) + end + attrs end # Format attributes nicely for inspect. |