LoginSignup
17

More than 5 years have passed since last update.

Rails4で「You should not use the `match` method〜」のRuntimeError

Last updated at Posted at 2013-08-18
config/routes.rb
Railbook::Application.routes.draw do
  match ':controller(/:action(/:id(.:format)))'
end

以下のようなRuntimeErrorが表示される。

You should not use the `match` method in your router without specifying an HTTP method. If you want to expose your action to both GET and POST, add `via: [:get, :post]` option. If you want to expose your action to GET, use `get` in the router: Instead of: match "controller#action" Do: get "controller#action"

以下のようにroutes.rbを修正

config/routes.rb
Railbook::Application.routes.draw do
  get ':controller(/:action(/:id(.:format)))'
end

参考

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
17