Closed gravitystorm closed 1 year ago
https://github.com/rubocop/rubocop-rails/issues/1058
Given there's already a PR for the issue, I think the best approach is to wait for it to be released, then fix the issues while turning on the option.
https://github.com/openstreetmap/openstreetmap-website/pull/4274
There's a lot of code where we want to try loading one record and get
nil
if that's not working (e.g. record is not visible).We currently use a mixture of
find_by(:id => 123)
andwhere(:id => 123).first
. These are slightly different, but only when you expect thewhere()
to return more than one record, which afaict doens't apply to us.I think the find_by is cleaner and easier to read.