Disabling links to current page in Layouts

Hello,

I was wondering how I can control the navigation links in a layout to not show a link to the current page/action.

I have a layout with a navigation area that has links to various actions. I do not want the link to the current page/action to be visible. I know I can create a different template for each actions - but how Un-DRY. So is there a way for the template to know which action/page we are on and then use that information to decide what to show - like in PHP? Code examples are always helpful.

Thanks in advance --K *Please don't just tell me to buy XXX book - I have them - at least tell me where to look

I was wondering how I can control the navigation links in a layout to not show a link to the current page/action.

I have a layout with a navigation area that has links to various actions. I do not want the link to the current page/action to be visible. I know I can create a different template for each actions - but how Un-DRY. So is there a way for the template to know which action/page we are on and then use that information to decide what to show - like in PHP? Code examples are always helpful.

check out Peak Obsession

In views you can also use controller.controller_name, controller.action_name

Regards, Rimantas

I was wondering how I can control the navigation links in a layout to not show a link to the current page/action.

I have a layout with a navigation area that has links to various actions. I do not want the link to the current page/action to be visible. I know I can create a different template for each actions - but how Un-DRY. So is there a way for the template to know which action/page we are on and then use that information to decide what to show - like in PHP? Code examples are always helpful.

link_to_unless_current(name, options = {}, html_options = {}, *parameters_for_method_reference, &block)

Creates a link tag of the given name using an URL created by the set of options, unless the current request uri is the same as the links, in which case only the name is returned (or the given block is yielded, if one exists). This is useful for creating link bars where you dont want to link to the page currently being viewed.

Or for more customization link_to_if or link_to_unless....

-philip

Beautiful. Thanks to all.