title: Rails: How can I show a block with or without a link based on a condition (link_to_if)
body: <p>I have a complex block of tags (<code>&lt;h3&gt;</code>, <code>&lt;p&gt;</code>, ...) that I want to render with a link or without a link around it based on a condition.</p>
  
  <p>I know about <code>link_to_if</code> that works like that:</p>
  
  <pre><code>&lt;% link_to_if condition, name, path %&gt;
  </code></pre>
  
  <p>if the condition is <code>false</code> only the name will be rendered. </p>
  
  <p>And I know about the <code>link_to</code> with <code>&amp;block</code>:</p>
  
  <pre><code>&lt;% link_to path do %&gt;
    [complex content]
  &lt;% end %&gt;
  </code></pre>
  
  <p>I want a combination of both. A <code>link_to_if</code> statement that accepts a <code>&amp;block</code>, so that the block will be rendered without a link around it, if the condition is <code>false</code>. Unfortunately the <code>link_to_if</code> statement with a <code>&amp;block</code> works not like the <code>link_to</code> statement :(</p>
  
  <p>Does anyone have suggestion for me? Any help is highly appreciated</p>