--- !ruby/object:RI::MethodDescription 
aliases: []

block_params: 
comment: 
- !ruby/struct:SM::Flow::P 
  body: Creates a link tag of the given <tt>name</tt> using a URL created by the set of <tt>options</tt> 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). You can give link_to_unless_current a block which will specialize the default behavior (e.g., show a &quot;Start Here&quot; link rather than the link's text).
- !ruby/struct:SM::Flow::H 
  level: 4
  text: Examples
- !ruby/struct:SM::Flow::P 
  body: Let's say you have a navigation menu...
- !ruby/struct:SM::Flow::VERB 
  body: "  &lt;ul id=&quot;navbar&quot;&gt;\n    &lt;li&gt;&lt;%= link_to_unless_current(&quot;Home&quot;, { :action =&gt; &quot;index&quot; }) %&gt;&lt;/li&gt;\n    &lt;li&gt;&lt;%= link_to_unless_current(&quot;About Us&quot;, { :action =&gt; &quot;about&quot; }) %&gt;&lt;/li&gt;\n  &lt;/ul&gt;\n"
- !ruby/struct:SM::Flow::P 
  body: If in the &quot;about&quot; action, it will render...
- !ruby/struct:SM::Flow::VERB 
  body: "  &lt;ul id=&quot;navbar&quot;&gt;\n    &lt;li&gt;&lt;a href=&quot;/controller/index&quot;&gt;Home&lt;/a&gt;&lt;/li&gt;\n    &lt;li&gt;About Us&lt;/li&gt;\n  &lt;/ul&gt;\n"
- !ruby/struct:SM::Flow::P 
  body: "...but if in the &quot;index&quot; action, it will render:"
- !ruby/struct:SM::Flow::VERB 
  body: "  &lt;ul id=&quot;navbar&quot;&gt;\n    &lt;li&gt;Home&lt;/li&gt;\n    &lt;li&gt;&lt;a href=&quot;/controller/about&quot;&gt;About Us&lt;/a&gt;&lt;/li&gt;\n  &lt;/ul&gt;\n"
- !ruby/struct:SM::Flow::P 
  body: The implicit block given to link_to_unless_current is evaluated if the current action is the action given. So, if we had a comments page and wanted to render a &quot;Go Back&quot; link instead of a link to the comments page, we could do something like this...
- !ruby/struct:SM::Flow::VERB 
  body: "   &lt;%=\n       link_to_unless_current(&quot;Comment&quot;, { :controller =&gt; 'comments', :action =&gt; 'new}) do\n          link_to(&quot;Go back&quot;, { :controller =&gt; 'posts', :action =&gt; 'index' })\n       end\n    %&gt;\n"
full_name: ActionView::Helpers::UrlHelper#link_to_unless_current
is_singleton: false
name: link_to_unless_current
params: (name, options = {}, html_options = {}, &block)
visibility: public
