Permalink
Browse files

return early from add_request_method

  • Loading branch information...
1 parent 92d16ec commit 404feeb2e486597215f28d3922a65d443c643e6e @tenderlove tenderlove committed May 30, 2014
Showing with 11 additions and 11 deletions.
  1. +11 −11 actionpack/lib/action_dispatch/routing/mapper.rb
@@ -209,18 +209,18 @@ def verify_callable_constraint(callable_constraint)
end
def add_request_method(via, conditions)
- unless via == [:all]
- if via.empty?
- msg = "You should not use the `match` method in your router without specifying an HTTP method.\n" \
- "If you want to expose your action to both GET and POST, add `via: [:get, :post]` option.\n" \
- "If you want to expose your action to GET, use `get` in the router:\n" \
- " Instead of: match \"controller#action\"\n" \
- " Do: get \"controller#action\""
- raise ArgumentError, msg
- end
-
- conditions[:request_method] = via.map { |m| m.to_s.dasherize.upcase }
+ return if via == [:all]
+
+ if via.empty?
+ msg = "You should not use the `match` method in your router without specifying an HTTP method.\n" \
+ "If you want to expose your action to both GET and POST, add `via: [:get, :post]` option.\n" \
+ "If you want to expose your action to GET, use `get` in the router:\n" \
+ " Instead of: match \"controller#action\"\n" \
+ " Do: get \"controller#action\""
+ raise ArgumentError, msg
end
+
+ conditions[:request_method] = via.map { |m| m.to_s.dasherize.upcase }
end
def app(blocks)

0 comments on commit 404feeb

Please sign in to comment.