路由匹配错误从2.3升级到5.2.3

时间:2019-05-24 23:11:20

标签: ruby-on-rails ruby-on-rails-5

我正在将应用程序从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

1 个答案:

答案 0 :(得分:1)

match方法在rails 5.0或更高版本中已被弃用,原因是鼓励人们仅使用GETPOST

参考:https://github.com/rails/rails/issues/5964

您可以使用GETPOST或编辑MATCH路线,如下所示:-

match ':controller/:action/:id', via: [:get, :post]