The truncate method includes the length of that parameter as part of
the maximum length.  Here's the documentation and source:
http://github.com/rails/rails/tree/master/actionpack/lib/action_view/helpers/text_helper.rb#L71

-Dan Manges
http://www.dcmanges.com/blog

On Sep 19, 5:32 pm, Sav <[EMAIL PROTECTED]> wrote:
> Any idea why the truncate() function returns the wrong number of
> characters when using HTML as the 3rd (truncate_string) parameter?...
>
> <%= truncate(body, 100) %>
> Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec risus
> ipsum, accumsan ut, consecte...
>
> <%= truncate(body, 100, ' +') %>
> Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec risus
> ipsum, accumsan ut, consecte +
>
> <%= truncate(body, 100, ' <a href="#" class="more">more...</a>') %>
> Lorem ipsum dolor sit amet, consectetuer adipiscing elit more...
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to