What is a common approach to scope records by those that an user can “read”?

后端 未结 5 765
太阳男子
太阳男子 2020-12-21 13:11

I am using Ruby on Rails 3.2.2 and I would like to know what is a common approach when it must be checked if an user has proper authorizations to \"read\" records present in

5条回答
  •  情歌与酒
    2020-12-21 13:26

    I think you sholud look for declarative_authorization gem. With its with_permissions_to method you can easily perfom such database queries. For example: Article.with_permissions_to(:read).limit(10).offset(20)

提交回复
热议问题