diff options
author | José Valim <jose.valim@gmail.com> | 2011-10-26 09:31:56 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-10-26 09:31:56 +0200 |
commit | 80768b739ed7e2053d85a01dd5fa60bde67aad9a (patch) | |
tree | fed13bcef542b8a05dab8d1f9c833f5efabd1ad9 /actionpack/lib/action_controller | |
parent | aef62c4b4e89e7fa91973c188c9e7f281a44ecd0 (diff) | |
download | rails-80768b739ed7e2053d85a01dd5fa60bde67aad9a.tar.gz rails-80768b739ed7e2053d85a01dd5fa60bde67aad9a.tar.bz2 rails-80768b739ed7e2053d85a01dd5fa60bde67aad9a.zip |
Responders now return 204 No Content for API requests without a response body (as in the new scaffold)
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r-- | actionpack/lib/action_controller/metal/responder.rb | 22 |
1 files changed, 1 insertions, 21 deletions
diff --git a/actionpack/lib/action_controller/metal/responder.rb b/actionpack/lib/action_controller/metal/responder.rb index c7827309dd..b932302a60 100644 --- a/actionpack/lib/action_controller/metal/responder.rb +++ b/actionpack/lib/action_controller/metal/responder.rb @@ -202,10 +202,8 @@ module ActionController #:nodoc: display resource elsif post? display resource, :status => :created, :location => api_location - elsif has_empty_resource_definition? - display empty_resource, :status => :ok else - head :ok + head :no_content end end @@ -269,24 +267,6 @@ module ActionController #:nodoc: @action ||= ACTIONS_FOR_VERBS[request.request_method_symbol] end - # Check whether resource needs a specific definition of empty resource to be valid - # - def has_empty_resource_definition? - respond_to?("empty_#{format}_resource") - end - - # Delegate to proper empty resource method - # - def empty_resource - send("empty_#{format}_resource") - end - - # Return a valid empty JSON resource - # - def empty_json_resource - "{}" - end - def resource_errors respond_to?("#{format}_resource_errors") ? send("#{format}_resource_errors") : resource.errors end |