Add and apply Rails/WhereNot rubocop rule

We simplify the code a little bit, and make it more consistent since we
were already using `where.not` in most places.
This commit is contained in:
Javi Martín
2021-08-09 23:07:14 +02:00
parent 69dda19af7
commit 8ae138aa19
7 changed files with 12 additions and 10 deletions

View File

@@ -1,19 +1,19 @@
section "Flagging Debates & Comments" do
40.times do
debate = Debate.all.sample
flagger = User.where(["users.id <> ?", debate.author_id]).all.sample
flagger = User.where.not(id: debate.author_id).all.sample
Flag.flag(flagger, debate)
end
40.times do
comment = Comment.all.sample
flagger = User.where(["users.id <> ?", comment.user_id]).all.sample
flagger = User.where.not(id: comment.user_id).all.sample
Flag.flag(flagger, comment)
end
40.times do
proposal = Proposal.all.sample
flagger = User.where(["users.id <> ?", proposal.author_id]).all.sample
flagger = User.where.not(id: proposal.author_id).all.sample
Flag.flag(flagger, proposal)
end
end