Rails routes: GET without param :id

后端 未结 7 979
名媛妹妹
名媛妹妹 2021-01-01 08:56

I\'m developing a REST api based on rails. To use this api, you MUST be logged in. Regarding that, I\'d like to create a method me in my user controller that wi

7条回答
  •  有刺的猬
    2021-01-01 09:26

    Resource routes are designed to work this way. If you want something different, design it yourself, like this.

    match 'users/me' => 'users#me', :via => :get
    

    Put it outside of your resources :users block

提交回复
热议问题