From 57352f86d43f6d3ee30f07d795087e68bf07f521 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Tue, 24 Apr 2007 16:58:24 +0000 Subject: Improved performance by relying less on exception raising #8159 [Blaine] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6571 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/lib/active_record/base.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'activerecord/lib/active_record/base.rb') 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 -- cgit v1.2.3