You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 12, 2021. It is now read-only.
Ryan, I have a model that's permission is based on a variety of conditions. I've been going in circles to define the CanCan condition correctly and it continues to get very messy. I was wondering if you had a suggestion that might be helpful here?
Ryan, I have a model that's permission is based on a variety of conditions. I've been going in circles to define the CanCan condition correctly and it continues to get very messy. I was wondering if you had a suggestion that might be helpful here?
Models:
User
Room (id, password_required (boolean)
UserRoom (user_id, room_id, banned (boolean)
User Stories:
So far I have:
def initialize(user, room, room_password)
.....
can :show, Room if room && user.try(:is_a_room_member, room) == true && user.try(:is_a_banned_room_member, room) == false
As you can see the above doesn't solve all the stories and it's already getting ugly.
Any suggestions on how this can be simplified/cleaner and work?
Thank you