ryanb/cancan — Issue #498: Problem with namespaced class
Author: RiceT
Created: 2011-10-25 22:52:09+00:00
State: open

Hi all
I saw at least more or less the same issue that the one I have but can't fiy it.

Rails 3.0.1
Cancan 1.6.7

for convenience I put authorize_resource instruction in the Application Controller => no worries , Cancan working fine for all controllers with no namespace.
I just created a module called supervision (not through an engine), so controllers are sitting in app/controllers/supervision and all classes are named Supervision::

Issue:
When loading the index page for Supervision::Service class, I have the following message.

NameError in Supervision/servicesController#index
uninitialized constant Service

I thought to a Cancan problem, checked the Wiki and tried:

class Supervision::ServicesController < ApplicationController
authorize_resource :class => "Supervision::Service"

And it does not work, I had to temporarily include skip_authorize_resource. May be there is a conflict with the authorize_resource instruction in the application controller.
Any idea to help me?
Many thanks in advance