提交 237272e0 编写于 作者: T Travis Pew

Fix ActionDispatch::Request method explanations

The methods, "post?", "put?", "head?", etc. contain an incorrect
explanation. They state that they are equivalent to request_method ==
:type, but this is not accurate because the methods convert the string
to a symbol. They are actually equivalent to:
  request_method_symbol == :type
上级 afa31cf3
......@@ -94,31 +94,31 @@ def method_symbol
end
# Is this a GET (or HEAD) request?
# Equivalent to <tt>request.request_method == :get</tt>.
# Equivalent to <tt>request.request_method_symbol == :get</tt>.
def get?
HTTP_METHOD_LOOKUP[request_method] == :get
end
# Is this a POST request?
# Equivalent to <tt>request.request_method == :post</tt>.
# Equivalent to <tt>request.request_method_symbol == :post</tt>.
def post?
HTTP_METHOD_LOOKUP[request_method] == :post
end
# Is this a PUT request?
# Equivalent to <tt>request.request_method == :put</tt>.
# Equivalent to <tt>request.request_method_symbol == :put</tt>.
def put?
HTTP_METHOD_LOOKUP[request_method] == :put
end
# Is this a DELETE request?
# Equivalent to <tt>request.request_method == :delete</tt>.
# Equivalent to <tt>request.request_method_symbol == :delete</tt>.
def delete?
HTTP_METHOD_LOOKUP[request_method] == :delete
end
# Is this a HEAD request?
# Equivalent to <tt>request.method == :head</tt>.
# Equivalent to <tt>request.method_symbol == :head</tt>.
def head?
HTTP_METHOD_LOOKUP[method] == :head
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册