Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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: http://git.io/deL_5g
- Loading branch information