diff options
author | Tarmo Tänav <tarmo@itech.ee> | 2008-08-17 00:20:55 +0300 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2008-08-16 22:26:11 +0100 |
commit | 96607996eaa826b5299780c7c9142e6e0157d198 (patch) | |
tree | bfe3d0a54a0d688c9d9df9c4b78040730b330e93 /activerecord/test/cases/associations/join_model_test.rb | |
parent | 8cfdcdb35db6e2f6fd5a72a38f4352beab148af1 (diff) | |
download | rails-96607996eaa826b5299780c7c9142e6e0157d198.tar.gz rails-96607996eaa826b5299780c7c9142e6e0157d198.tar.bz2 rails-96607996eaa826b5299780c7c9142e6e0157d198.zip |
Test for eager loading of STI subclasses from htm associations
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
Diffstat (limited to 'activerecord/test/cases/associations/join_model_test.rb')
-rw-r--r-- | activerecord/test/cases/associations/join_model_test.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/join_model_test.rb b/activerecord/test/cases/associations/join_model_test.rb index 9e79d9c8a1..7a0427aabc 100644 --- a/activerecord/test/cases/associations/join_model_test.rb +++ b/activerecord/test/cases/associations/join_model_test.rb @@ -694,6 +694,13 @@ class AssociationsJoinModelTest < ActiveRecord::TestCase assert ! david.categories.include?(category) end + def test_has_many_through_goes_through_all_sti_classes + sub_sti_post = SubStiPost.create!(:title => 'test', :body => 'test', :author_id => 1) + new_comment = sub_sti_post.comments.create(:body => 'test') + + assert_equal [9, 10, new_comment.id], authors(:david).sti_post_comments.map(&:id).sort + end + private # create dynamic Post models to allow different dependency options def find_post_with_dependency(post_id, association, association_name, dependency) |