Support for :all
alexr17 opened this issue · 1 comments
alexr17 commented
CanCanCan has a nice shortcut for managing all models: can :manage, :all
and it would be great if this gem had that too, or something similar. I noticed a quick fix that would allow something like this to work:
can :read, ApplicationRecord
In permission.rb
:
def matches_subject?(subject)
subject == @subject || subject.class <= @subject
end
Adding .class
onto the end of @subject
allows the second condition to work successfully. Otherwise, it evaluates to nil
.
def matches_subject?(subject)
subject == @subject || subject.class <= @subject.class
end
alexr17 commented
I'm going to close this because it can be monkey patched, and my solution actually introduces a different bug.