From d49fa21a0318c75a30b52e7d68ee3338f1fdf429 Mon Sep 17 00:00:00 2001 From: Chris Kampmeier Date: Fri, 26 Dec 2008 16:32:14 -0500 Subject: ActionController::Request docs: fix reference to nonexistent ACCEPTED_HTTP_METHODS constant, clean up #request_method and #method --- actionpack/lib/action_controller/request.rb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'actionpack') diff --git a/actionpack/lib/action_controller/request.rb b/actionpack/lib/action_controller/request.rb index 8a02130d88..732172668e 100755 --- a/actionpack/lib/action_controller/request.rb +++ b/actionpack/lib/action_controller/request.rb @@ -41,17 +41,19 @@ module ActionController HTTP_METHODS = %w(get head put post delete options) HTTP_METHOD_LOOKUP = HTTP_METHODS.inject({}) { |h, m| h[m] = h[m.upcase] = m.to_sym; h } - # The true HTTP request \method as a lowercase symbol, such as :get. - # UnknownHttpMethod is raised for invalid methods not listed in ACCEPTED_HTTP_METHODS. + # Returns the true HTTP request \method as a lowercase symbol, such as + # :get. If the request \method is not listed in the HTTP_METHODS + # constant above, an UnknownHttpMethod exception is raised. def request_method method = @env['REQUEST_METHOD'] HTTP_METHOD_LOOKUP[method] || raise(UnknownHttpMethod, "#{method}, accepted HTTP methods are #{HTTP_METHODS.to_sentence}") end memoize :request_method - # The HTTP request \method as a lowercase symbol, such as :get. - # Note, HEAD is returned as :get since the two are functionally - # equivalent from the application's perspective. + # Returns the HTTP request \method used for action processing as a + # lowercase symbol, such as :post. (Unlike #request_method, this + # method returns :get for a HEAD request because the two are + # functionally equivalent from the application's perspective.) def method request_method == :head ? :get : request_method end -- cgit v1.2.3