I am accessing model Company::Item in controller Security::MyController. It is giving error uninitialised constant Security::Company::Item . So basically it is appending ‘Security::’ for given model. It is not the case with some other models say Security::User(model in same module security). What could be possible explanation for this?
I am accessing model Company::Item in controller Security::MyController. It is giving error uninitialised constant
Share
This is a scope resolution problem. You should try using
::Company::IteminsideSecurity::MyControllerAccording to Ruby Language Spec
Prefixing :: will prevent Ruby from applying the default scope in that context, which in your case, is the
Security::scope