diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-07-02 11:04:46 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-07-02 11:04:46 -0300 |
commit | 7442f5a09cc424e9f0309e183b7b60530fa7a66b (patch) | |
tree | ae6af253475e1075af41f6faccd1997ced7cb7f3 /activerecord/lib/active_record/core.rb | |
parent | b1e4c5998e71b7c18fcca4636f1f50816dabc34e (diff) | |
parent | b6e15f9a1111469ac1c41eee23fa6ab3f2ec5be3 (diff) | |
download | rails-7442f5a09cc424e9f0309e183b7b60530fa7a66b.tar.gz rails-7442f5a09cc424e9f0309e183b7b60530fa7a66b.tar.bz2 rails-7442f5a09cc424e9f0309e183b7b60530fa7a66b.zip |
Merge pull request #16016 from sgrif/sg-dup
Don't error when `dup`ing a record with no PK
Diffstat (limited to 'activerecord/lib/active_record/core.rb')
-rw-r--r-- | activerecord/lib/active_record/core.rb | 3 |
1 files changed, 1 insertions, 2 deletions
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? |