rubocop/rails-style-guide

Suggestion: Add description about Active Record redundant `all`

masato-bkn opened this issue · 1 comments

I suggest to add description about Active Record redundant all.

I often come across all used as receiver of Active Record query methods.

# bad
User.all.order(:created_at)
User.all.find(id)
User.all.where(id: ids)

# good
User.order(:created_at)
User.find(id)
User.where(id: ids)

In these cases, the output is same with or without all, so I think it's redundant and could be removed.

If there's a positive reaction to this issue, I plan to submit a PR.

koic commented

@masato-bkn There is no issue if the redundant all method call will be removed. Can you open a PR?