I've added a controller collaborators
to manage a particular type of join association between Users
and Companies
. The issue is that whenever I load anything from collaborators
, I get the error
uninitialized constant Collaborator
From my understanding, this is because there is no model Collaborator
and I am using cancancan
for authorization. From the old cancan (note not cancancan) documentation, I've been able to gather that controllers that don't have a corresponding model need to have a model manually authorized for them something like: load_and_authorize_resource :the_model, :parent => false
.
This seems to work if I disable load_and_authorize_resource
in my application.rb controller.
SO my quesestion is: what is the best way to authorize controllers that don't have corresponding models with cancancan? Can I continue to load_and_authorize_resource
in my application controller?
Many thanks in advance.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…