I currently have two models, “User” and “Report”. I want to find out
best way of restricting reports from certain user groups.
Given the following three groups…
- General Manager
- Store Manager
I would like to restrict the users from seeing certain reports.
- General Manager can see all reports - no restrictions
- Store Manager can see their reports and all employee reports
- Employee can see only their own reports
I’ve currently been restricting access by basically “if” statements in
partials, but it seems like only a matter of time before one of these
(by my own logic). So the idea came to me to try and set the
“default_scope” based on what role the user has… To my knowledge it
doesn’t work this way though. What would be the equivalent of this
Or is there a better idea? Thanks!