A
A
Aleksandr2018-05-05 16:51:44
Ruby on Rails
Aleksandr, 2018-05-05 16:51:44

Rails routes or how to get rid of match?

Hello!
If it creates an action that is triggered by a request, how to change to ? So far I have this:resources :questionsnewGETPOST

match '/questions/new', to: 'questions#new', as: 'new_question', via: :post

Link
Avoid using #match to define routes

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vasily Shakhunov, 2018-05-05
@if4752

post '/questions/new', to: 'questions#new', as: 'new_question'

?

B
blackst0ne, 2018-05-21
@blackst0ne

resourcescreates a set of specific routes . This is described in the documentation.
If you need to add a non-standard route, and - this is just the same, then you need to prescribe it additionally bypost :new

post '/questions/new', to: 'questions#new', as: 'new_question'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question