aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/metal
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2011-10-26 09:31:56 +0200
committerJosé Valim <jose.valim@gmail.com>2011-10-26 09:31:56 +0200
commit80768b739ed7e2053d85a01dd5fa60bde67aad9a (patch)
treefed13bcef542b8a05dab8d1f9c833f5efabd1ad9 /actionpack/lib/action_controller/metal
parentaef62c4b4e89e7fa91973c188c9e7f281a44ecd0 (diff)
downloadrails-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/metal')
-rw-r--r--actionpack/lib/action_controller/metal/responder.rb22
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