aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2007-04-24 16:58:24 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2007-04-24 16:58:24 +0000
commit57352f86d43f6d3ee30f07d795087e68bf07f521 (patch)
tree983428b4d96cbb0988858080ee6537235f2970bd /activerecord/lib
parentb3c4e301f490be57677aa3137329522e572b1d0f (diff)
downloadrails-57352f86d43f6d3ee30f07d795087e68bf07f521.tar.gz
rails-57352f86d43f6d3ee30f07d795087e68bf07f521.tar.bz2
rails-57352f86d43f6d3ee30f07d795087e68bf07f521.zip
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
Diffstat (limited to 'activerecord/lib')
-rwxr-xr-xactiverecord/lib/active_record/base.rb8
1 files changed, 7 insertions, 1 deletions
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