From 1e6c50e21bdb8c99116a7dc6921ef3eb4ed9531a Mon Sep 17 00:00:00 2001 From: Jim Remsik and Tim Pope Date: Mon, 9 Mar 2009 13:42:51 +0000 Subject: Ensure has_many :through works with changed primary keys [#736 state:resolved] Signed-off-by: Pratik Naik --- .../cases/associations/has_many_through_associations_test.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'activerecord/test/cases') 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 ac00508b5f..c3ad0ee6de 100644 --- a/activerecord/test/cases/associations/has_many_through_associations_test.rb +++ b/activerecord/test/cases/associations/has_many_through_associations_test.rb @@ -8,9 +8,12 @@ require 'models/comment' require 'models/tag' require 'models/tagging' require 'models/author' +require 'models/owner' +require 'models/pet' +require 'models/toy' class HasManyThroughAssociationsTest < ActiveRecord::TestCase - fixtures :posts, :readers, :people, :comments, :authors + fixtures :posts, :readers, :people, :comments, :authors, :owners, :pets, :toys def test_associate_existing assert_queries(2) { posts(:thinking);people(:david) } @@ -251,4 +254,8 @@ class HasManyThroughAssociationsTest < ActiveRecord::TestCase author.author_favorites.create(:favorite_author_id => 3) assert_equal post.author.author_favorites, post.author_favorites end + + def test_has_many_association_through_a_has_many_association_with_nonstandard_primary_keys + assert_equal 1, owners(:blackbeard).toys.count + end end -- cgit v1.2.3