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

前端 未结 6 1485
日久生厌
日久生厌 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:22

    Just need to use this, to use only get and post in the same route

    resources :articles do
      member do
        match 'action_do-you_want', via: [:get, :post]
      end
    end
    

提交回复
热议问题