aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorJim Remsik and Tim Pope <dev+bigtiger+tpope@hashrocket.com>2009-03-09 13:42:51 +0000
committerPratik Naik <pratiknaik@gmail.com>2009-03-09 13:43:28 +0000
commit1e6c50e21bdb8c99116a7dc6921ef3eb4ed9531a (patch)
tree1658deea2328ef01332fd8589dfaa461f4186d87 /activerecord/test/cases
parent1ab2ff58eddee8ac523624dd097424f9a760ad8b (diff)
downloadrails-1e6c50e21bdb8c99116a7dc6921ef3eb4ed9531a.tar.gz
rails-1e6c50e21bdb8c99116a7dc6921ef3eb4ed9531a.tar.bz2
rails-1e6c50e21bdb8c99116a7dc6921ef3eb4ed9531a.zip
Ensure has_many :through works with changed primary keys [#736 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/associations/has_many_through_associations_test.rb9
1 files changed, 8 insertions, 1 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 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