How to handle multiple HTTP methods in the same Rails controller action

前端 未结 6 1423
日久生厌
日久生厌 2021-01-31 02:50

Let\'s say I want to support both GET and POST methods on the same URL. How would I go about handling that in a rails controller action?

6条回答
  •  被撕碎了的回忆
    2021-01-31 03:15

    you can try this

    match '/posts/multiple_action', to: 'posts#multiple_action', via: [:create, :patch, :get, :options]
    

提交回复
热议问题