diff options
Diffstat (limited to 'activerecord/lib')
-rwxr-xr-x | activerecord/lib/active_record/base.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 8b562e2ffb..8d98796af1 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -1751,9 +1751,9 @@ module ActiveRecord #:nodoc: def clone attrs = self.attributes_before_type_cast attrs.delete(self.class.primary_key) - self.class.new do |record| - record.send :instance_variable_set, '@attributes', attrs - end + record = self.class.new + record.send :instance_variable_set, '@attributes', attrs + record end # Updates a single attribute and saves the record. This is especially useful for boolean flags on existing records. |