title: Rails link_to for truncated html using helpers end up with undefined method
body: <p>I'm trying to truncate posts that are over 250 to include a link to the show page. In my controller I have:</p>
  
  <p>Right now I have in my index view:</p>
  
  <pre><code>&lt;% @posts.includes(:categories, :author).each do |posts| %&gt;
  &lt;%= truncate_html posts.content.html_safe, :length =&gt; 250, omission:'...Continue Reading' %&gt;
  &lt;%= link_to "...Continue Reading", post_path(posts.url_name)%&gt;
  </code></pre>
  
  <p>It loads properly with no errors. Right now the omission section doesn't click over to a new page so I added in the link_to. I then tried something like:</p>
  
  <pre><code>&lt;%= truncate_html posts.content.html_safe, :length =&gt; 250, link_to: "...Continue Reading", post_path(posts.url_name) %&gt;
  </code></pre>
  
  <p>Ended up with the following error:</p>
  
  <pre><code>syntax error, unexpected ')', expecting =&gt; ", post_path(posts.url_name) );@output_buffer.safe_append=' ^ 
  </code></pre>
  
  <p>So I decided to try and build it out in a helper and just plug the helper in instead. For my helper I built out:</p>
  
  <pre><code>def post_length
   output = truncate(@posts.content, length: 250)
   output += link_to('...Continue Reading', post_path(posts.url_name)) if post.content.size &gt; 250
   output.html_safe
  end
  </code></pre>
  
  <p>Then put in my index the following:</p>
  
  <pre><code>&lt;%= post_length %&gt;
  </code></pre>
  
  <p>I end up getting undefined method 'content'. I've tried doing in the helper: posts.content, post.content, @post.content, etc. Does not work. Am I doing the helper wrong?</p>
  
  <p>I've also tried the following:</p>
  
  <pre><code>def post_truncate(&amp;block)
  truncate(@posts.content,
    length: 250,
    separator: ' ',
    omission: "...") {
      link_to "Something", post_path(posts.url_name)
    }
    )
  end
  </code></pre>
  
  <p>I end up with syntax error, unexpected ')', expecting keyword_end (SyntaxError)</p>