From b6e15f9a1111469ac1c41eee23fa6ab3f2ec5be3 Mon Sep 17 00:00:00 2001 From: Sean Griffin Date: Wed, 2 Jul 2014 07:00:26 -0600 Subject: Don't error when `dup`ing a record with no PK --- activerecord/lib/active_record/core.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'activerecord/lib/active_record/core.rb') diff --git a/activerecord/lib/active_record/core.rb b/activerecord/lib/active_record/core.rb index 224112b559..30b8485c8b 100644 --- a/activerecord/lib/active_record/core.rb +++ b/activerecord/lib/active_record/core.rb @@ -315,9 +315,8 @@ module ActiveRecord ## def initialize_dup(other) # :nodoc: - pk = self.class.primary_key @attributes = @attributes.dup - @attributes.write_from_database(pk, nil) + @attributes.reset(self.class.primary_key) run_callbacks(:initialize) unless _initialize_callbacks.empty? -- cgit v1.2.3