diff options
author | Rick Olson <technoweenie@gmail.com> | 2006-04-05 15:36:02 +0000 |
---|---|---|
committer | Rick Olson <technoweenie@gmail.com> | 2006-04-05 15:36:02 +0000 |
commit | 4d232025b7260834dc4a4403b2b9effd043215c4 (patch) | |
tree | 81d658cc663b852218d1ec2adb7a4b2d49231edb /activerecord/test/associations_join_model_test.rb | |
parent | 11323ceb2833512e727fba6d7a7f61befeee4bfd (diff) | |
download | rails-4d232025b7260834dc4a4403b2b9effd043215c4.tar.gz rails-4d232025b7260834dc4a4403b2b9effd043215c4.tar.bz2 rails-4d232025b7260834dc4a4403b2b9effd043215c4.zip |
Added descriptive error messages for invalid has_many :through associations: going through :has_one or :has_and_belongs_to_many [Rick]
Added support for going through a polymorphic has_many association: (closes #4401) [Rick]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4169 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 | 16 |
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 f0ee2eb9e7..b7f0af173b 100644 --- a/activerecord/test/associations_join_model_test.rb +++ b/activerecord/test/associations_join_model_test.rb @@ -295,6 +295,22 @@ class AssociationsJoinModelTest < Test::Unit::TestCase assert_equal comments(:more_greetings), authors(:david).comments.find(2) end + def test_has_many_through_polymorphic_has_one + assert_raise(ActiveRecord::HasManyThroughSourceAssociationMacroError) { authors(:david).tagging } + end + + def test_has_many_through_polymorphic_has_many + assert_equal [taggings(:welcome_general), taggings(:thinking_general)], authors(:david).taggings.uniq.sort_by { |t| t.id } + end + + def test_has_many_through_has_many_through + assert_raise(ActiveRecord::HasManyThroughSourceAssociationMacroError) { authors(:david).tags } + end + + def test_has_many_through_habtm + assert_raise(ActiveRecord::HasManyThroughSourceAssociationMacroError) { authors(:david).post_categories } + end + def test_eager_load_has_many_through_has_many author = Author.find :first, :conditions => ['name = ?', 'David'], :include => :comments, :order => 'comments.id' SpecialComment.new; VerySpecialComment.new |