ActionView::Helpers::TextHelper
def truncate(text, options = {}, &block)

Description

Truncates a long string to a given length.

Arguments

Changing a value updates the ERB and HTML.

If the string is longer than the :length option (defaults to 30), cuts off the end to fit that length and adds .... The length includes the .... The returned string is escaped (a string marked html_safe is not escaped when it is not cut).
options= {}
17
The length of the truncated string (including the ...).
" "
When given, cuts at the last occurrence of this string within the length (for example, to avoid cutting words in half). If it is not found within the length, cuts at the length, as when this is omitted.
"… (more)"
Appends the given string instead of .... The length includes this string too.
false leaves the returned string unescaped.
Options not listed here are ignored.

ERB

Changes from the previous output: Added Removed Changed


          

HTML