Devise + CanCan just prevent other users from editing objects

前端 未结 3 972
遥遥无期
遥遥无期 2021-02-10 15:58

How would you prevent other users from editing a object, say a profile object that does - not - belong to themselves?

Most online examples are complexes with multiple us

3条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-10 16:21

    Give something like this a try....

    can :update, Profile, :user_id => user.id
    

提交回复
热议问题