diff options
author | Sean Griffin <sean@thoughtbot.com> | 2014-07-02 07:00:26 -0600 |
---|---|---|
committer | Sean Griffin <sean@thoughtbot.com> | 2014-07-02 07:00:26 -0600 |
commit | b6e15f9a1111469ac1c41eee23fa6ab3f2ec5be3 (patch) | |
tree | e79bbe4411c271f95ad8612550ebd4bd43b19794 /activerecord/test | |
parent | 5c87b5c5248154cf8aa76cce9a24a88769de022d (diff) | |
download | rails-b6e15f9a1111469ac1c41eee23fa6ab3f2ec5be3.tar.gz rails-b6e15f9a1111469ac1c41eee23fa6ab3f2ec5be3.tar.bz2 rails-b6e15f9a1111469ac1c41eee23fa6ab3f2ec5be3.zip |
Don't error when `dup`ing a record with no PK
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/dup_test.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/activerecord/test/cases/dup_test.rb b/activerecord/test/cases/dup_test.rb index 409d9a82e2..638cffe0e6 100644 --- a/activerecord/test/cases/dup_test.rb +++ b/activerecord/test/cases/dup_test.rb @@ -141,5 +141,17 @@ module ActiveRecord ensure Topic.default_scopes = prev_default_scopes end + + def test_dup_without_primary_key + klass = Class.new(ActiveRecord::Base) do + self.table_name = 'parrots_pirates' + end + + record = klass.create! + + assert_nothing_raised do + record.dup + end + end end end |