[openstreetmap/openstreetmap-website] Prefer find_by() instead of where().first (PR #4274)
Andy Allan
notifications at github.com
Wed Oct 4 17:54:01 UTC 2023
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.
You can view, comment on, or merge this pull request online at:
https://github.com/openstreetmap/openstreetmap-website/pull/4274
-- Commit Summary --
* Prefer find_by() instead of where().first
-- File Changes --
M .rubocop.yml (3)
M app/controllers/api/traces_controller.rb (2)
M app/controllers/application_controller.rb (2)
M app/controllers/diary_entries_controller.rb (6)
M app/controllers/traces_controller.rb (8)
M test/controllers/api/traces_controller_test.rb (12)
M test/controllers/diary_entries_controller_test.rb (6)
M test/controllers/friendships_controller_test.rb (32)
M test/controllers/traces_controller_test.rb (6)
M test/models/node_test.rb (6)
M test/models/trace_test.rb (2)
-- Patch Links --
https://github.com/openstreetmap/openstreetmap-website/pull/4274.patch
https://github.com/openstreetmap/openstreetmap-website/pull/4274.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/4274
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/4274 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20231004/1760cda7/attachment-0001.htm>
More information about the rails-dev
mailing list