<p dir="auto">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.</p>
<hr>
<h4>You can view, comment on, or merge this pull request online at:</h4>
<p> <a href='https://github.com/openstreetmap/openstreetmap-website/pull/4274'>https://github.com/openstreetmap/openstreetmap-website/pull/4274</a></p>
<h4>Commit Summary</h4>
<ul>
<li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/4274/commits/1700c23dd1018b66a268b4c76fcf9fb2a09a35ab" class="commit-link">1700c23</a> Prefer find_by() instead of where().first</li>
</ul>
<h4 style="display: inline-block">File Changes </h4> <p style="display: inline-block">(<a href="https://github.com/openstreetmap/openstreetmap-website/pull/4274/files">11 files</a>)</p>
<ul>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/4274/files#diff-4f894049af3375c2bd4e608f546f8d4a0eed95464efcdea850993200db9fef5c">.rubocop.yml</a>
(3)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/4274/files#diff-e84777f55861eeb73fed3029e0429118ff087b7dd2314e398acadc4157dbaa05">app/controllers/api/traces_controller.rb</a>
(2)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/4274/files#diff-766c34fd6533171eaf54300c153f89d6002c35c02cfc9c5b219251f85180ad07">app/controllers/application_controller.rb</a>
(2)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/4274/files#diff-4b73866ef57c70fca07c0f330d7a57aae939b11e4aae0514f303df3aa3762f89">app/controllers/diary_entries_controller.rb</a>
(6)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/4274/files#diff-2602c06a2618f83c1470c924563b55c738e3c94ffb6480e637ca0f4ce130eaba">app/controllers/traces_controller.rb</a>
(8)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/4274/files#diff-27e35476a27da8e60d7a83a6b48c4997ac172d00264392a8cb70c8f43f6b55cb">test/controllers/api/traces_controller_test.rb</a>
(12)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/4274/files#diff-10a5c4533814c8b1222f0ef0833c82edd68584d85757fc431557b39813777c19">test/controllers/diary_entries_controller_test.rb</a>
(6)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/4274/files#diff-d08bf923837e3a75d07fc54a9692a43ba307bb94ec45bade0f3b6ba778b5acc4">test/controllers/friendships_controller_test.rb</a>
(32)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/4274/files#diff-db7c9d7ea4afdcafd812aac88f5a378c22117fbce829dc93d905152f2c09f471">test/controllers/traces_controller_test.rb</a>
(6)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/4274/files#diff-fc4f9f9fac2300ac52e47916c83e6bc893b0cf37602253f876cb035d67850ea2">test/models/node_test.rb</a>
(6)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/4274/files#diff-9fd2e1fe5658049094afe3aa0ab829848cd04fd0b3f62d56ad51b1ae40efdc2e">test/models/trace_test.rb</a>
(2)
</li>
</ul>
<h4>Patch Links:</h4>
<ul>
<li><a href='https://github.com/openstreetmap/openstreetmap-website/pull/4274.patch'>https://github.com/openstreetmap/openstreetmap-website/pull/4274.patch</a></li>
<li><a href='https://github.com/openstreetmap/openstreetmap-website/pull/4274.diff'>https://github.com/openstreetmap/openstreetmap-website/pull/4274.diff</a></li>
</ul>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/openstreetmap/openstreetmap-website/pull/4274">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLK7MVD6FOBOXX6TFDDX5WPDTAVCNFSM6AAAAAA5TAKT42VHI2DSMVQWIX3LMV43ASLTON2WKOZRHEZDMNZRGE2DEMY">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AAK2OLLVFKMDY6U3MF4BI5DX5WPDTA5CNFSM6AAAAAA5TAKT42WGG33NNVSW45C7OR4XAZNFJFZXG5LFVJRW63LNMVXHIX3JMTHHFV2IP4.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><openstreetmap/openstreetmap-website/pull/4274</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/openstreetmap-website/pull/4274",
"url": "https://github.com/openstreetmap/openstreetmap-website/pull/4274",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>