title: Ruby on Rails, trim the text
body: <p>Why this code is not work?</p>
  
  <pre><code>&lt;%= truncate(post.text, :length =&gt; post.text.rindex(".", 500)) %&gt;
  </code></pre>
  
  <p>I need to trim the text on last dot before 500th symbol.</p>