From 9f5a9aa35f1fa252a99498dc464677c968e694ba Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Mon, 15 Oct 2007 07:13:40 +0000 Subject: Factor out checks for duplicable objects. Closes #9333. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7908 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/lib/active_record/base.rb | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (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 ff0809676f..67a0299490 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -2205,13 +2205,7 @@ module ActiveRecord #:nodoc: def clone_attribute_value(reader_method, attribute_name) value = send(reader_method, attribute_name) - - case value - when nil, Fixnum, true, false - value - else - value.clone - end + value.duplicable? ? value.clone : value rescue TypeError, NoMethodError value end -- cgit v1.2.3