RajR
RajR

Reputation: 1

Routes match error upgrading from 2.3 to 5.2.3

I am upgrading an app from Rails 2.3 to Rails 5.2.3 and ran into an error with match in routes.rb

Error I get is: ActionController::RoutingError (No route matches [POST] "/"):

actionpack (5.2.3) lib/action_dispatch/middleware/debug_exceptions.rb:65:in `call'

routes.rb file is:

  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

Upvotes: 0

Views: 133

Answers (1)

Tariq Mamdouh
Tariq Mamdouh

Reputation: 71

match method is deprecated in rails 5.0 or above, the reason is to encourage people to use only GET and POST.

reference: https://github.com/rails/rails/issues/5964

you can either use GET and POST or edit the MATCH route to be like this:-

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

Upvotes: 1

Related Questions