Ok, I read the CanCan documentation more carefully and this jumped out
the screen…
“This will fetch the project using Project.find(params[:project_id]) on
every controller action, save it in the @project instance variable…”
When I was going to /users the companies resource was empty and it would
throw the Access Denied error unless I used shallow nesting (:shallow =>
true).
So I should’ve been going to /companies/45/users instead. Then companies
get loaded as well as users. My problem with this is that it can only
display users from a certain company.
I’m still not accomplishing what I want. Because the page should display
all companies and all users under each company. I’m closer to finding
the answer than I was before. I’ll keep on trying.