aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/associations/has_many_through_associations_test.rb
diff options
context:
space:
mode:
authorArthur Neves <arthurnn@gmail.com>2014-02-20 10:34:57 -0500
committerArthur Neves <arthurnn@gmail.com>2014-02-20 10:36:06 -0500
commitf96831e5ec200d957265adb7df765214123fbd6e (patch)
tree924654dca8684bff29fde09650cb80c6226f100a /activerecord/test/cases/associations/has_many_through_associations_test.rb
parentd038a72bf3fb202d909337872467278586731411 (diff)
downloadrails-f96831e5ec200d957265adb7df765214123fbd6e.tar.gz
rails-f96831e5ec200d957265adb7df765214123fbd6e.tar.bz2
rails-f96831e5ec200d957265adb7df765214123fbd6e.zip
Add regression test for collection proxy reader
[related #14116]
Diffstat (limited to 'activerecord/test/cases/associations/has_many_through_associations_test.rb')
-rw-r--r--activerecord/test/cases/associations/has_many_through_associations_test.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/has_many_through_associations_test.rb b/activerecord/test/cases/associations/has_many_through_associations_test.rb
index 47592f312e..026a7fe635 100644
--- a/activerecord/test/cases/associations/has_many_through_associations_test.rb
+++ b/activerecord/test/cases/associations/has_many_through_associations_test.rb
@@ -817,6 +817,13 @@ class HasManyThroughAssociationsTest < ActiveRecord::TestCase
assert author.named_categories(true).include?(category)
end
+ def test_collection_exists
+ author = authors(:mary)
+ category = Category.create!(author_ids: [author.id], name: "Primary")
+ assert category.authors.exists?(id: author.id)
+ assert category.reload.authors.exists?(id: author.id)
+ end
+
def test_collection_delete_with_nonstandard_primary_key_on_belongs_to
author = authors(:mary)
category = author.named_categories.create(:name => "Primary")