aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/associations_join_model_test.rb
diff options
context:
space:
mode:
authorRick Olson <technoweenie@gmail.com>2006-03-19 02:01:40 +0000
committerRick Olson <technoweenie@gmail.com>2006-03-19 02:01:40 +0000
commit0925c6b6a06dd9fb5599d24ec9c2f4e11282bc12 (patch)
treee7ef51eb0343a1f6a255da151e458502869cd105 /activerecord/test/associations_join_model_test.rb
parent8463cd646ec5b8f439577a7c2ca225179709b5ed (diff)
downloadrails-0925c6b6a06dd9fb5599d24ec9c2f4e11282bc12.tar.gz
rails-0925c6b6a06dd9fb5599d24ec9c2f4e11282bc12.tar.bz2
rails-0925c6b6a06dd9fb5599d24ec9c2f4e11282bc12.zip
Allow has_many :through to work on has_many associations (closes #3864) [sco@scottraymond.net]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3964 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test/associations_join_model_test.rb')
-rw-r--r--activerecord/test/associations_join_model_test.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/activerecord/test/associations_join_model_test.rb b/activerecord/test/associations_join_model_test.rb
index f53a7669f4..4b0f4e4c33 100644
--- a/activerecord/test/associations_join_model_test.rb
+++ b/activerecord/test/associations_join_model_test.rb
@@ -230,6 +230,22 @@ class AssociationsJoinModelTest < Test::Unit::TestCase
end
end
+ def test_has_many_through_has_many_find_all
+ assert_equal comments(:greetings), authors(:david).comments.find(:all).first
+ end
+
+ def test_has_many_through_has_many_find_first
+ assert_equal comments(:greetings), authors(:david).comments.find(:first)
+ end
+
+ def test_has_many_through_has_many_find_conditions
+ assert_equal comments(:does_it_hurt), authors(:david).comments.find(:first, :conditions => "comments.type='SpecialComment'", :order => 'comments.id')
+ end
+
+ def test_has_many_through_has_many_find_by_id
+ assert_equal comments(:more_greetings), authors(:david).comments.find(2)
+ end
+
private
# create dynamic Post models to allow different dependency options
def find_post_with_dependency(post_id, association, association_name, dependency)