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
The way to go is to use singular resources:
So, instead of resources
use resource
:
Sometimes, you have a resource that clients always look up without referencing an ID. For example, you would like /profile to always show the profile of the currently logged in user. In this case, you can use a singular resource to map /profile (rather than /profile/:id) to the show action [...]
So, in your case:
resource :user do
get :me, on: :member
end
# => me_api_user GET /api/users/me(.:format) api/v1/users#me {:format=>"json"}