method
link_to_unless_current
link_to_unless_current(name, options = {}, html_options = {}, *parameters_for_method_reference, &block) public 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 link’s, 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 don’t want to link to the page currently being viewed.
Register or log in to add new notes.
tordans - November 26, 2009
szadok - July 1, 2011 - (<= v3.0.9)
0 thanks
How to use with HAML
Are you using HAML and try to do the block-thing (do…)? Please note that the whole block has to be in a single line. More: http://groups.google.com/group/haml/browse_thread/thread/52e62ef501c504a3
0 thanks
Another way to use
<%=
link_to_unless_current("Profile", profile_path)
%> also works (instead of pointing to controller/action)

