mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-06 22:36:07 +00:00
In the step 6 of the spree upgrade, when deleting an order's line item from /admin we get an HTML response (the whole edit form) that gets inserted into the flash error. It's not 100% clear why we added a respond_to block for JSON but since juery-rails sends ajax requests with application/javascript, */* in the ACCEPTS request header, Rails falls back to the first specified respond_to block, which is HTML. We don't hit the JSON block. In order for this to work, this commit replaces the JSON respond_to block with one for JS with the exact same behaviour; returning a 204. This is also the format the spree controller action we duplicated originally has besides HTML.