Reputation: 13407
I'm using controller.controller_name
to see where I'm at, and set the active
class on my menu.
The problem is I have a namespace: :admin
in my routes... and I need to check if I'm in any controller which inherits from AdminController
. Right now, controller_name
only pulls up the child controller's name... but really I need it to say 'admin'.
How can I access the name of the controller it's inheriting from?
Upvotes: 0
Views: 1908
Reputation: 1306
If I'm understanding your question correctly, you could do:
controller.class.superclass
This should return AdminController
if your current controller is indeed inheriting from AdminController
.
Also, controller.class
should give you the fully namespaced controller name.
Upvotes: 2