A bit of a conundrum around using JSON for updating resources:
- If I use "POST" against /resource/:id - I get an undefined route
- If I use "PUT" against a /resource/:id - I do get to the right method, but respond_with seems to return an empty content (see code below).
What's a GUI to do when it wants a nice reply for updating an object? Do I have to resort to explicit rendering?
The
204 No Content
response is the default behavior fromrespond_with
. You can either do the explicit renders if you want something different, or if you want a different behavior consistently you can define your ownActionController::Responder
subclass.I'd recommend reading the source of the default responder, and checking out some other ones here:
https://github.com/plataformatec/responders