rails/jbuilder — pull request #143 by claudiob (2013-09-04 23:43:41+00:00)
Title: Respond to PUT/PATCH API request with :ok

This commits changes the behavior of the Rails scaffold generator of jbuilder
for successful PUT/PATCH requests on the :json format.

Previously, the scaffold controller would just return :no_content (204).
After this commit, the scaffold controller returns :ok (200) and the entire
updated object as the response body.

The rationale behind this commit is that a PUT, POST or PATCH call may make
modifications to fields of the underlying resource that weren't part of the
provided parameters (for example: created_at or updated_at timestamps).

This commit prevents an API consumer from having to hit the API again for an
updated representation. Rails already provides the created representation after
a POST, so it is coherent to have the same behavior on PUT and PATCH.

This commit is parallel to a pull request to rails/rails to change the
default behavior to respond_to: https://github.com/rails/rails/issues/12096