Skip to content

Commit

Permalink
Update lib/rubocop/cop/rails/where_missing.rb
Browse files Browse the repository at this point in the history
Co-authored-by: Koichi ITO <[email protected]>
  • Loading branch information
ydah and koic authored Nov 21, 2022
1 parent 2783e35 commit c878677
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions lib/rubocop/cop/rails/where_missing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,11 @@ def on_send(node)
private

def root_receiver(node)
if node&.parent&.send_type?
if node.parent.method?(:or) || node.parent.method?(:and)
node
else
root_receiver(node.parent)
end
else
parent = node.parent
if !parent&.send_type? || parent.method?(:or) || parent.method?(:and)
node
else
root_receiver(parent)
end
end

Expand Down

0 comments on commit c878677

Please sign in to comment.