aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/CHANGELOG2
-rwxr-xr-xactiverecord/lib/active_record/base.rb8
2 files changed, 9 insertions, 1 deletions
diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG
index b6d009bbb0..da7572149c 100644
--- a/activerecord/CHANGELOG
+++ b/activerecord/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Improved cloning performance by relying less on exception raising #8159 [Blaine]
+
* Added ActiveRecord::Base.inspect to return a column-view like #<Post id:integer, title:string, body:text> [DHH]
* Added yielding of Builder instance for ActiveRecord::Base#to_xml calls [DHH]
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index c46e97b1b7..d1e70ce04d 100755
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -2231,7 +2231,13 @@ module ActiveRecord #:nodoc:
def clone_attribute_value(reader_method, attribute_name)
value = send(reader_method, attribute_name)
- value.clone
+
+ case value
+ when nil, Fixnum, true, false
+ value
+ else
+ value.clone
+ end
rescue TypeError, NoMethodError
value
end