aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xactiverecord/lib/active_record/base.rb12
1 files changed, 1 insertions, 11 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index 1770026bb4..8b022ef6d4 100755
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -808,17 +808,7 @@ module ActiveRecord #:nodoc:
# Returns a clone of the record that hasn't been assigned an id yet and is treated as a new record.
def clone
- attr = Hash.new
-
- self.attribute_names.each do |name|
- begin
- attr[name] = read_attribute(name).clone
- rescue TypeError
- attr[name] = read_attribute(name)
- end
- end
-
- cloned_record = self.class.new(attr)
+ cloned_record = self.class.new(self.attributes)
cloned_record.instance_variable_set "@new_record", true
cloned_record.id = nil
cloned_record