diff options
author | Rick Olson <technoweenie@gmail.com> | 2006-03-19 07:14:48 +0000 |
---|---|---|
committer | Rick Olson <technoweenie@gmail.com> | 2006-03-19 07:14:48 +0000 |
commit | fcd4c9529c071d3c77cbf57fe733869da0d3fde8 (patch) | |
tree | 76b40bc3ed6d210edfb33a7c09d428d160c12e10 /activerecord/test/associations_join_model_test.rb | |
parent | 8ea1fadcbeefeb1b7f4bc46c083b0c761cde41e3 (diff) | |
download | rails-fcd4c9529c071d3c77cbf57fe733869da0d3fde8.tar.gz rails-fcd4c9529c071d3c77cbf57fe733869da0d3fde8.tar.bz2 rails-fcd4c9529c071d3c77cbf57fe733869da0d3fde8.zip |
Allow has_many :through associations to find the source association by setting a custom class (closes #4307) [jonathan@bluewire.net.nz]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3973 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test/associations_join_model_test.rb')
-rw-r--r-- | activerecord/test/associations_join_model_test.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/activerecord/test/associations_join_model_test.rb b/activerecord/test/associations_join_model_test.rb index db5f362610..4ea2b6e684 100644 --- a/activerecord/test/associations_join_model_test.rb +++ b/activerecord/test/associations_join_model_test.rb @@ -55,7 +55,11 @@ class AssociationsJoinModelTest < Test::Unit::TestCase def test_polymorphic_has_many_going_through_join_model_with_inheritance assert_equal tags(:general), posts(:thinking).tags.first end - + + def test_polymorphic_has_many_going_through_join_model_with_inheritance_with_custom_class_name + assert_equal tags(:general), posts(:thinking).funky_tags.first + end + def test_polymorphic_has_many_create_model_with_inheritance post = posts(:thinking) assert_instance_of SpecialPost, post @@ -234,6 +238,10 @@ class AssociationsJoinModelTest < Test::Unit::TestCase assert_equal comments(:greetings), authors(:david).comments.find(:all, :order => 'comments.id').first end + def test_has_many_through_has_many_find_all_with_custom_class + assert_equal comments(:greetings), authors(:david).funky_comments.find(:all, :order => 'comments.id').first + end + def test_has_many_through_has_many_find_first assert_equal comments(:greetings), authors(:david).comments.find(:first, :order => 'comments.id') end |