Tuesday, 27 August 2013

List only allowed objects with cancan

List only allowed objects with cancan

I use cancan for accessing resource. Let's assume that I have user which
can only read his own posts. Can I filter posts to only ones created by
user using cancan or I should create model method which will filter data
for me?
Can I do something like
can :read, Post, user_id: user.id
And receive only user posts list?

No comments:

Post a Comment