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

This commits changes the behavior of `respond_to` for successful PUT/PATCH
requests on format associated with APIs, such as :xml and :json.

Previously, `respond_to` would just return :no_content (204) and no body.
After this commit, it 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.

See discussion at https://github.com/rails/rails/issues/12096