Ruby on rails more elegant way to authenticate that users can edit only their own content

后端 未结 3 840
傲寒
傲寒 2021-01-07 04:07

I currently authenticate that users can edit their own content only by:

@posts = current_user.posts.find(params[:id])

Is t

3条回答
  •  长发绾君心
    2021-01-07 04:37

    Have you checked out aegis? If you are not willing to code something by hand then you can check out aegis. Meets your requirements. It has extensive documentation too. http://github.com/makandra/aegis

    See this:

    • Checking permissions when no user is signed in

    • Checking permissions

提交回复
热议问题