I just upgraded to 0.10.0 and everything works really well with the exception of the condition i used to flag the active navigation. <% if @request[''controller''] == "dashboard" %>id="current"<% end %>>Dashboard</a> Is there a better/different approach to this? Thanks, Beau _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
> I just upgraded to 0.10.0 and everything works really well with the > exception of the condition i used to flag the active navigation. > > <% if @request[''controller''] == "dashboard" %>id="current"<% end > %>>Dashboard</a> > > Is there a better/different approach to this?<%= ''id="current"'' if @request[''controller''] == ''dashboard''%>>Dashboard</a> But, I''m sure there''s an even better way. Perhaps you could use the content_tag (http://rails.rubyonrails.com/classes/ActionView/Helpers/TagHelper.html#M000298) method... -- rick http://techno-weenie.net
> I just upgraded to 0.10.0 and everything works really well with the > exception of the condition i used to flag the active navigation. > > <% if @request[''controller''] == "dashboard" %>id="current"<% end > %>>Dashboard</a> > > Is there a better/different approach to this?Any chance the current_page? method in URLHelper could work for you?; http://rails.rubyonrails.com/classes/ActionView/Helpers/UrlHelper.html#M000258 You might be able to use the controller_name method instead: http://rails.rubyonrails.com/classes/ActionController/Base.html#M000096
> <% if @request[''controller''] == "dashboard" %>id="current"<% end > %>>Dashboard</a> > > Is there a better/different approach to this?I would suggest something like: link_to_unless_current("Dashboard", :controller => ''dashboard) { |name,options| link_to name, options, { :id => ''current''} }
Thanks, For all the reply''s, I won''t have a chance to try out the suggestions till later. Darn day job is getting in the way of fun. Beau -----Original Message----- From: rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Michael Raidel Sent: Monday, February 28, 2005 10:51 AM To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: Re: [Rails] flagging by request[controller]> <% if @request[''controller''] == "dashboard" %>id="current"<% end > %>>Dashboard</a> > > Is there a better/different approach to this?I would suggest something like: link_to_unless_current("Dashboard", :controller => ''dashboard) { |name,options| link_to name, options, { :id => ''current''} } _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails