File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -1101,6 +1101,26 @@ User.where.not(status: 'active', plan: 'basic')
11011101User.where.not('status = ? AND plan = ?', 'active', 'basic')
11021102----
11031103
1104+ === Redundant `all` [[redundant-all]]
1105+
1106+ Using `all` as a receiver for Active Record query methods is redundant.
1107+ The result won't change without `all`, so it can be removed.
1108+
1109+ [source, ruby]
1110+ ----
1111+ # bad
1112+ User.all.find(id)
1113+ User.all.order(:created_at)
1114+ users.all.where(id: ids)
1115+ user.articles.all.order(:created_at)
1116+
1117+ # good
1118+ User.find(id)
1119+ User.order(:created_at)
1120+ users.where(id: ids)
1121+ user.articles.order(:created_at)
1122+ ----
1123+
11041124== Migrations
11051125
11061126=== Schema Version [[schema-version]]
You can’t perform that action at this time.
0 commit comments