aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2010-10-14 12:59:16 +0100
committerJon Leighton <j@jonathanleighton.com>2010-10-14 12:59:16 +0100
commitbc821a56114ae6f6d0b595475ad9e71f01f46f35 (patch)
tree68f73c478155eec9c722c4cf7ab194938385ccc5 /activerecord/lib/active_record
parent22782e2cc131863b72e457636f9a995a6ae50136 (diff)
downloadrails-bc821a56114ae6f6d0b595475ad9e71f01f46f35.tar.gz
rails-bc821a56114ae6f6d0b595475ad9e71f01f46f35.tar.bz2
rails-bc821a56114ae6f6d0b595475ad9e71f01f46f35.zip
Added test_has_many_through_has_many_with_has_many_through_habtm_source_reflection and make it pass
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/associations/through_association_scope.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/associations/through_association_scope.rb b/activerecord/lib/active_record/associations/through_association_scope.rb
index c3f12fee2b..a52672eecd 100644
--- a/activerecord/lib/active_record/associations/through_association_scope.rb
+++ b/activerecord/lib/active_record/associations/through_association_scope.rb
@@ -92,7 +92,11 @@ module ActiveRecord
polymorphic_conditions(left, left)
)
when :has_and_belongs_to_many
- raise NotImplementedError
+ joins << inner_join_sql(
+ right_table_and_alias,
+ table_aliases[left].first, left.primary_key_name,
+ table_aliases[right], right.klass.primary_key
+ )
end
else
case left.source_reflection.macro
@@ -106,7 +110,7 @@ module ActiveRecord
when :has_many, :has_one
if right.macro == :has_and_belongs_to_many
join_table, right_table = table_aliases[right]
- right_table_and_alias = table_name_and_alias(right.quoted_table_name, right_table)
+ right_table_and_alias = table_name_and_alias(right.quoted_table_name, right_table)
else
right_table = table_aliases[right]
end