Just that: can i know the name of my current controller in my views? I want to highlite in my main template (the one i use for all the pages) the current page, to do that i need to know the current controller, and i don't want to use a controller variable with a before filter because i think there should be a easiest way.
on 2007-06-13 22:45
on 2007-06-13 22:49
Emmanuel Oga <firstname.lastname@example.org> wrote: > Just that: can i know the name of my current controller in my views? The current controller is always in the "@controller" variable, so: @controller.class.to_s If you want the name as a string. If you just want to test if the controller is a certain type use the "===" operator instead, eg; if WidgetController === @controller # running under widgetcontroller else # ... end Cheers, Tyler
on 2007-06-13 23:14
umm.... controller.controller_name might be a better solution. for FooController you get 'foo' HTH Trevor On 6/13/07, Tyler MacDonald <email@example.com> wrote: > > -- -- Trevor Squires http://somethinglearned.com