rest - Rails - best practice of handling restful update of a single attribute -


i have :users resource typical attributes (first name, last name, email...) user can update, have user attributes typical user can not change himself or can change in different way, example role or deactivated_at.

a non-restful solution be:

resources :users   member     put :change_role     put :activate   end end 

i writing api , goal stick rest constraints as possible. options see them are:

  1. send patch :update, , add more logic in controller action
  2. expose endpoints attributes , add new controllers such cases, example
resources :users   resource :role, only: :update end 
  1. expose endpoints attributes , route them new action of existing controller
resources :users   resource :role, only: :update, to: 'users#update_role' end 

and still not sure :activate?

is there other way, , recommended practice in situation?


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -