Commit d63886d
committed
Add "Finding missing relationship records" rule
If you're using Rails 6.1 or higher, prefer `where.missing`
over `left_joins` and `where` to find missing relationship records.
It can be expressed in a more simplified.
```ruby
# bad
Post.left_joins(:author).where(authors: { id: nil })
# good
Post.where.missing(:author)
```1 parent 43a9832 commit d63886d
1 file changed
+13
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
938 | 938 | | |
939 | 939 | | |
940 | 940 | | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
941 | 954 | | |
942 | 955 | | |
943 | 956 | | |
| |||
0 commit comments