aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2011-03-10 19:04:00 +0000
committerJon Leighton <j@jonathanleighton.com>2011-03-10 19:04:00 +0000
commit6490d65234b89d4d28308b72b13d4834fd44bbb3 (patch)
tree4a643e149574251dd16ea479d593260588900518 /activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb
parent67b17d029a8eeddd908cce2d4e0e27e4708e8463 (diff)
downloadrails-6490d65234b89d4d28308b72b13d4834fd44bbb3.tar.gz
rails-6490d65234b89d4d28308b72b13d4834fd44bbb3.tar.bz2
rails-6490d65234b89d4d28308b72b13d4834fd44bbb3.zip
Move the code which builds a scope for through associations into a generic AssociationScope class which is capable of building a scope for any association.
Diffstat (limited to 'activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb')
-rw-r--r--activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb22
1 files changed, 0 insertions, 22 deletions
diff --git a/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb b/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb
index 028630977d..217213808b 100644
--- a/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb
+++ b/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb
@@ -26,10 +26,6 @@ module ActiveRecord
record
end
- def association_scope
- super.joins(construct_joins)
- end
-
private
def count_records
@@ -48,24 +44,6 @@ module ActiveRecord
end
end
- def construct_joins
- right = join_table
- left = reflection.klass.arel_table
-
- condition = left[reflection.klass.primary_key].eq(
- right[reflection.association_foreign_key])
-
- right.create_join(right, right.create_on(condition))
- end
-
- def construct_owner_conditions
- super(join_table)
- end
-
- def select_value
- super || reflection.klass.arel_table[Arel.star]
- end
-
def invertible_for?(record)
false
end