Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

There was a problem

You must be a member of this account.

This project is archived and is in readonly mode.

truncate_on_last_space

#1409

Hello!

I try to modify 'truncate' helper to truncate string on last space character before specified length (default 30)

Example:


truncate("This is a string that will go longer then the default truncate length of 30", :omission => "[...]")

will return "This is a string that [...]" instead "This is a string that wil[...]"

Reported by seban · November 18th, 2008 @ 09:22 PM

State: invalid
Milestone: 2.x
Assigned to: Pratik Pratik
Importance: none

Activity

  1. Pratik
    Pratik
    • Assigned user set to Pratik
    • Tag changed from texthelper, text_helper to patch, texthelper, text_helper
    • State changed from new to invalid

    This is expected behaviour really. You should just define a custom helper method if you want a different behaviour.

    Thanks !

    March 7th, 2009 @ 03:42 PM