我正在将应用程序从Rails 2.3升级到Rails 5.2.3,并且在route.rb中遇到匹配错误
我得到的错误是: ActionController :: RoutingError(没有路由与[POST]“ /”匹配):
actionpack(5.2.3)lib / action_dispatch / middleware / debug_exceptions.rb:65:in`call'
routes.rb文件是:
FullcalendarAssets::Application.routes.draw do
resource :calendar, :only => [:show]
resources :events
resources :emails
resources :conversations
resources :users
root :to => 'homeowners#login'
match ':controller(/:action(/:id))(.:format)'
end
答案 0 :(得分:1)
match方法在rails 5.0或更高版本中已被弃用,原因是鼓励人们仅使用GET
和POST
。
参考:https://github.com/rails/rails/issues/5964
您可以使用GET
和POST
或编辑MATCH
路线,如下所示:-
match ':controller/:action/:id', via: [:get, :post]