Hi
In my application, I would like to know if a class is a subclass of ApplicationController, I mean, if a class is a controller.
I thought about this kind of code:
klass = classname while klass && klass != ApplicationController klass = klass.superclass end
It's working well but I'm wondering if there is a way to use the ruby fonction kind_of? to do it well. Actually, when I want to check if (for example) UsersController is a controller, I write: UsersController.kind_of?(ApplicationController), but it doesn't work at all. Do you have any ideas why ? Or do you know a better solution to handle it ?
Thanks
Have a nice day