aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/associations/has_many_through_associations_test.rb
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2010-12-16 10:29:13 +0000
committerAaron Patterson <aaron.patterson@gmail.com>2010-12-20 13:56:04 -0800
commitb8153fd5a18441567f787a33ca882acb3bb5088a (patch)
tree54fcc3863416a35bff709a88fcfe2e2c91d182fc /activerecord/test/cases/associations/has_many_through_associations_test.rb
parent9863d8a5f6576ab10df51230c0531cec8d4468f9 (diff)
downloadrails-b8153fd5a18441567f787a33ca882acb3bb5088a.tar.gz
rails-b8153fd5a18441567f787a33ca882acb3bb5088a.tar.bz2
rails-b8153fd5a18441567f787a33ca882acb3bb5088a.zip
Fix problem where wrong keys are used in JoinAssociation when an association goes :through a belongs_to [#2801 state:resolved]
Diffstat (limited to 'activerecord/test/cases/associations/has_many_through_associations_test.rb')
-rw-r--r--activerecord/test/cases/associations/has_many_through_associations_test.rb7
1 files changed, 7 insertions, 0 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 77bc369ecc..cf0eedbd13 100644
--- a/activerecord/test/cases/associations/has_many_through_associations_test.rb
+++ b/activerecord/test/cases/associations/has_many_through_associations_test.rb
@@ -479,4 +479,11 @@ class HasManyThroughAssociationsTest < ActiveRecord::TestCase
assert_equal 1, mary.unique_categorized_posts.length
assert_equal 1, mary.unique_categorized_post_ids.length
end
+
+ def test_joining_has_many_through_belongs_to
+ posts = Post.joins(:author_categorizations).
+ where('categorizations.id' => categorizations(:mary_thinking_sti).id)
+
+ assert_equal [posts(:eager_other)], posts
+ end
end