Ada-Developers-Academy / classroom-app

Application for tracking and providing feedback on Ada student PRs
http://classroom.adadevelopersacademy.org/
2 stars 5 forks source link

CanCanCan correctly loads singleton Repo resources #58

Closed Hamled closed 7 years ago

Hamled commented 7 years ago

The load_and_authorize_resource helper method from CanCanCan was unable to detect that ReposController#show should be getting a single Repo instance rather than the collection of all Repo instances because it was looking for params to have an :id key.

In our case, because the show action has a nested Cohort resource the route parameters are :repo_id and :cohort_id. We now specify to load_and_authorize_resource that it should look for :repo_id.