Method: ActionDispatch::Routing::Mapper::Mapping.check_via

Defined in:
actionpack/lib/action_dispatch/routing/mapper.rb

.check_via(via) ⇒ Object



104
105
106
107
108
109
110
111
112
113
114
# File 'actionpack/lib/action_dispatch/routing/mapper.rb', line 104

def self.check_via(via)
  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
  via
end