My ability model for cancan has been working well for 6+ months now. One of the controllers that has been around all that time is the QuestionsController. I recently added another controller, model and index page. The controller name is QuestionsBasicsController. In my ability model i have:
if user.permission >= 8 # admin
can :manage, [Question, QuestionsBasic]
end
At the top of QuestionsController and QuestionsBasicsController i have:
load_and_authorize_resource
I am able to access the index page for both QuestionsController and QuestionsBasicsController on my development machine. After I uploaded the ability model to my server i restarted the server. I can access the index page for Question but not for QuestionsBasic on my server. On my development machine i have ruby 1.9.2 while on my server i have 1.8.7. Could it be the Ruby version difference?
UPDATE: for what it is worth names of models that begin with the name of another model cause a problem,… at least with the way I have constructed my ability model. In addition, I recently found another model name that worked fine but for CanCan. I think it may have been a reserved word but am not positive on that. When I changed the name of the model, controller, route and code to a new name it passed CanCan. No reflection on CanCan though… I think it is AWESOME, AWESOME, AWESOME! Thanks, Ryan Bates!
agree with dleatham, try splitting your original statement into 2 lines: