Ok, so I want to set up a dynamic global menu for my application.  If  
I''m in certain controllers, I don''t want this menu to appear
at all.
Let''s assume that my application has 3 controllers:
     foo
     bar
     baz
     I don''t want the menu to appear at all in bar, but to appear in  
both foo and baz.  The menu will build itself with the correct  
contents for foo and baz already.  I just want no menu at all for  
bar.  So, I have the following code (w/in app/views/layouts/ 
appname.rhtml, so it should be called for every single view):
<%             unless controller == ''bar''
                 render(:partial => "shared/menu")
             end
%>
I just need to find out if the controller is bar or not - but no  
permutation of the above seems to work:
:controller, @controller, or controller == "BarController", etc.
I know this must be trivial to discover - what am I doing wrong?
Thanks!
-- Kimball
Kimball Larsen wrote:> I just need to find out if the controller is bar or not - but no > permutation of the above seems to work: > :controller, @controller, or controller == "BarController", etc.try: controller.controller_name http://rails.rubyonrails.com/classes/ActionController/Base.html#M000165 hth -- R.Livsey http://livsey.org
Thanks! That was it! -- Kimball On Sep 12, 2005, at 10:58 AM, Richard Livsey wrote:> Kimball Larsen wrote: > > >> I just need to find out if the controller is bar or not - but no >> permutation of the above seems to work: >> :controller, @controller, or controller == "BarController", etc. >> > > > try: > > controller.controller_name > > http://rails.rubyonrails.com/classes/ActionController/ > Base.html#M000165 > > hth > > -- > R.Livsey > http://livsey.org > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >