[openstreetmap/openstreetmap-website] Use `where()` instead of `find()` to prevent RecordNotFound (PR #4203)
Tom Hughes
notifications at github.com
Fri Aug 25 23:33:11 UTC 2023
As I thought the test is not looking for an exception, it's looking for a 404 response - the fact that might be generated internally by an exception currently is merely an implementation detail.
The question is, when a method looks up a set of resources and none of them exist should it return 404 or should it return 200 with an empty response set? You can certainly make arguments either way though my inclination would be to go with an empty response set.
Either can be implemented - for a 404 just test for an empty set and return a not found response, and for 200 just leave it as it is and fix the test to expect that.
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/4203#issuecomment-1694032925
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/4203/c1694032925 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20230825/112645ca/attachment.htm>
More information about the rails-dev
mailing list