Style: rename to clarifying arguments

Just scope this to just the two conceptually similar methods,
we're concerned with. (Don't submit rename PRs please.)
This commit is contained in:
Kasper Timm Hansen 2020-11-26 13:57:30 +01:00
parent 22990028a6
commit dda5e28a60
No known key found for this signature in database
GPG Key ID: 191153215EDA53D8
1 changed files with 5 additions and 6 deletions

View File

@ -66,12 +66,11 @@ module ActiveRecord
# # LEFT OUTER JOIN "authors" ON "authors"."id" = "posts"."author_id"
# # LEFT OUTER JOIN "comments" ON "comments"."post_id" = "posts"."id"
# # WHERE "authors"."id" IS NULL AND "comments"."id" IS NULL
def missing(*args)
args.each do |arg|
reflection = @scope.klass._reflect_on_association(arg)
opts = { reflection.table_name => { reflection.association_primary_key => nil } }
@scope.left_outer_joins!(arg)
@scope.where!(opts)
def missing(*associations)
associations.each do |association|
reflection = @scope.klass._reflect_on_association(association)
@scope.left_outer_joins!(association)
@scope.where!(reflection.table_name => { reflection.association_primary_key => nil })
end
@scope