]> git.openstreetmap.org Git - rails.git/commit
Prefer find_by() instead of where().first
authorAndy Allan <git@gravitystorm.co.uk>
Wed, 4 Oct 2023 16:53:58 +0000 (17:53 +0100)
committerAndy Allan <git@gravitystorm.co.uk>
Wed, 4 Oct 2023 16:53:58 +0000 (17:53 +0100)
commit1700c23dd1018b66a268b4c76fcf9fb2a09a35ab
treebc5409c827859066775baab5a52000d1721e7b3b
parentc8fc2218e5e342ad7afc9409974fd48a733ba94b
Prefer find_by() instead of where().first

These are very similar, differing only if we would expect multiple
results and the sorting is important. However, in all our cases
we're only expecting one result to be returned, and so find_by is
easier to read.
.rubocop.yml
app/controllers/api/traces_controller.rb
app/controllers/application_controller.rb
app/controllers/diary_entries_controller.rb
app/controllers/traces_controller.rb
test/controllers/api/traces_controller_test.rb
test/controllers/diary_entries_controller_test.rb
test/controllers/friendships_controller_test.rb
test/controllers/traces_controller_test.rb
test/models/node_test.rb
test/models/trace_test.rb