title: PUT requests in rails don't update the status on respond_with calls
body: <p>Given the following controller in rails:</p>
  
  <pre><code>class AccountsController &lt; ApplicationController
      respond_to :json, :xml
      def update
          @account = Account.where(uuid: params[:id]).first
          unless @account.nil?
              if @account.update_attributes params[:account]
                  respond_with @account, location: account_url(@account)
              else
                  respond_with error_hash, status: :unprocessable_entity, root: :error, location: api_account_url(@account)
              end
          else
              respond_with error_hash, status: :not_found, root: :error, location: accounts_url
          end
      end
  
      def error_hash
          { :example =&gt; "Example for this question", :parameter =&gt; 42 }
      end
  end
  </code></pre>
  
  <p>I would expect a <code>PUT</code> request to /accounts/update/ to do the following</p>
  
  <ol>
  <li>If the id exists, and the update_attributes call succeeds, deliver a <code>204 (No Content)</code> success message.  (I have it set to return @account, which would be nice, but no big deal.  204 is fine here.)</li>
  <li>If the id exists, but the data is bad, deliver a <code>422 (Unprocessable Entity)</code> error message, along with the xml/json to represent the error.</li>
  <li>If the id does not exist, deliver a <code>404 (Not Found)</code> error message, along with the xml/json to represent the error.</li>
  </ol>
  
  <p>What actually happens is:</p>
  
  <ol>
  <li>Deliver a 204 with no body.</li>
  <li>Deliver a 204 with no body.</li>
  <li>Deliver a 204 with no body.</li>
  </ol>
  
  <p>Why is it that it ignores both my status and my body?  I've had a similar setup for <code>GET</code> requests that work out just fine (correct status, correct body).</p>
  
  <p>Example <code>CURL</code> request (for an ID that does not exist):</p>
  
  <p><code>PUT</code> request</p>
  
  <pre>
  curl -i --header "Accept: application/xml" --header "Content-type: application/json" -X PUT -d '{"name": "whoop"}' http://localhost:3000/api/accounts/3d2cc5d0653911e2aaadc82a14fffee9
  HTTP/1.1 204 No Content 
  Location: http://localhost:3000/api/accounts
  X-Ua-Compatible: IE=Edge
  Cache-Control: no-cache
  X-Request-Id: bf0a02f452fbace65576aab6d2bd7c1e
  X-Runtime: 0.029193
  Server: WEBrick/1.3.1 (Ruby/1.9.3/2013-01-15)
  Date: Thu, 24 Jan 2013 08:01:31 GMT
  Connection: close
  Set-Cookie: _bankshare_session=BAh7BkkiD3Nlc3Npb25faWQGOgZFRkkiJWFmNmI2MmU0MzViMmE3N2YzMDIzOTdjMDJmZDhiMzEwBjsAVA%3D%3D--133e394eb760a7fce07f1fd51349dc46c2d51626; path=/; HttpOnly
  </pre>
  
  <p><code>GET</code> request</p>
  
  <pre>
  curl -i --header "Accept: application/json" --header "Content-type: application/json" -X GET http://localhost:3000/api/accounts/3d2cc5d0653911e2aaadc82a14fffee9
  HTTP/1.1 404 Not Found 
  Content-Type: application/json; charset=utf-8
  X-Ua-Compatible: IE=Edge
  Cache-Control: no-cache
  X-Request-Id: 9cc0d1cdfb27bb86a206cbc38cd75473
  X-Runtime: 0.005118
  Server: WEBrick/1.3.1 (Ruby/1.9.3/2013-01-15)
  Date: Thu, 24 Jan 2013 08:19:45 GMT
  Content-Length: 116
  Connection: Keep-Alive
  
  {"friendly-status":"not-found","status":404,"message":"No account with id '3d2cc5d0653911e2aaadc82a14fffee9' found"}
  </pre>