How to understand what rule was used

6 views
Skip to first unread message

mez...@gmail.com

unread,
Jul 5, 2016, 9:59:49 AM7/5/16
to cancancan
Hi guys.
I'm trying to use cancan for authorization and now I have two rules for a single subject: first checks that user owns subject instance and second that user has paid subscription. How can I understand what rule was used to deny access? I need that to show relevant message to user.

I think it could be useful to add some key into 'can' and 'cannot' methods, so that it will give us ability to distinguish different cases.

For example:
can :read, Article, reason: :why_access_denied do |article|
#some checks here
end

Thank you in advance.

Reply all
Reply to author
Forward
0 new messages