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:
- send patch :update, , add more logic in controller action
- expose endpoints attributes , add new controllers such cases, example
resources :users resource :role, only: :update end
- 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
Post a Comment