aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/associations/belongs_to_associations_test.rb
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2018-05-26 11:56:32 +0900
committerRyuta Kamizono <kamipo@gmail.com>2018-05-26 11:56:32 +0900
commite34c2050e996ffe7ae5feecb005117cd7df4ba74 (patch)
treee1a3cfbef28001b5554472fbed71d2241c38197e /activerecord/test/cases/associations/belongs_to_associations_test.rb
parent6edf354b656ec556c3573402019504a519531953 (diff)
downloadrails-e34c2050e996ffe7ae5feecb005117cd7df4ba74.tar.gz
rails-e34c2050e996ffe7ae5feecb005117cd7df4ba74.tar.bz2
rails-e34c2050e996ffe7ae5feecb005117cd7df4ba74.zip
Fix `different_target?` to respect custom primary key counter
Diffstat (limited to 'activerecord/test/cases/associations/belongs_to_associations_test.rb')
-rw-r--r--activerecord/test/cases/associations/belongs_to_associations_test.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/belongs_to_associations_test.rb b/activerecord/test/cases/associations/belongs_to_associations_test.rb
index b3f5de4c5f..c0dfa91a21 100644
--- a/activerecord/test/cases/associations/belongs_to_associations_test.rb
+++ b/activerecord/test/cases/associations/belongs_to_associations_test.rb
@@ -471,6 +471,13 @@ class BelongsToAssociationsTest < ActiveRecord::TestCase
assert_equal 1, debate.reload.replies_count
assert_equal 0, debate2.reload.replies_count
+ assert_no_queries do
+ reply.topic_with_primary_key = debate
+ end
+
+ assert_equal 1, debate.reload.replies_count
+ assert_equal 0, debate2.reload.replies_count
+
reply.topic_with_primary_key = debate2
assert_equal 0, debate.reload.replies_count