# Block of text method to make "..."

**URL:** <https://www.ruby-forum.com/t/block-of-text-method-to-make/104647>\
**Category:** Rails\
**Created:** [May 21, 2007, 6:43am UTC](https://www.ruby-forum.com/t/block-of-text-method-to-make/104647 "2007-05-21T06:43:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jko170](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/d07c76/32.png) [@jko170](https://www.ruby-forum.com/u/jko170)\
**Post date:** [May 21, 2007, 6:43am UTC](https://www.ruby-forum.com/t/block-of-text-method-to-make/104647/1 "2007-05-21T06:43:07Z")

</div>

What action view method turns this:

asdf asdf aslkj flkjasdfljf lkasdf  
asdlfkjsd flkajsdf ldkffljasf aslkfj  
asldfkjasdf nlfkajlskf lasdfkjaslfdj  
asl;fkaslf asdlfsalf

Into this:

asdf asdf aslkj flkjasdfljf lkasdf …

Thanks!

---

<div class="post-metadata">

**Author:** ![jko170](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/d07c76/32.png) [@jko170](https://www.ruby-forum.com/u/jko170)\
**Post date:** [May 21, 2007, 12:21pm UTC](https://www.ruby-forum.com/t/block-of-text-method-to-make/104647/2 "2007-05-21T12:21:12Z")

</div>

On 5/21/07, Phlip [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Browsers do that these days:
> 
> [css overflow ellipses - Google Search](http://www.google.com/search?q=css+overflow+ellipses)

Wouldn’t that only work on IE?

Nathan

---

<div class="post-metadata">

**Author:** ![jko170](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/d07c76/32.png) [@jko170](https://www.ruby-forum.com/u/jko170)\
**Post date:** [May 21, 2007, 7:14am UTC](https://www.ruby-forum.com/t/block-of-text-method-to-make/104647/3 "2007-05-21T07:14:08Z")

</div>

jko170 wrote:

> What action view method turns this:
> 
> asdf asdf aslkj flkjasdfljf lkasdf  
> asdlfkjsd flkajsdf ldkffljasf aslkfj  
> asldfkjasdf nlfkajlskf lasdfkjaslfdj  
> asl;fkaslf asdlfsalf
> 
> Into this:
> 
> asdf asdf aslkj flkjasdfljf lkasdf …

Browsers do that these days:

[http://www.google.com/search?q=css+overflow+ellipses](http://www.google.com/search?q=css+overflow+ellipses)

–  
Phlip  
[Test Driven Ajax (on Rails) [Book]](http://www.oreilly.com/catalog/9780596510657/)  
“Test Driven Ajax (on Rails)”  
assert\_xpath, assert\_javascript, & assert\_ajax

---

<div class="post-metadata">

**Author:** ![jko170](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/d07c76/32.png) [@jko170](https://www.ruby-forum.com/u/jko170)\
**Post date:** [May 21, 2007, 2:43pm UTC](https://www.ruby-forum.com/t/block-of-text-method-to-make/104647/4 "2007-05-21T14:43:53Z")

</div>

truncate does this, but i does not split by word, only by No. of  
Characters:

> **[ActionView::Helpers::TextHelper](https://api.rubyonrails.org/classes/ActionView/Helpers/TextHelper.html#M000615)**
>
> The TextHelper module provides a set of methods for filtering, formatting and transforming strings, which can reduce the amount of inline Ruby code in your views.

if you need it p split at word boundaries, have a look at this code  
snippet, you can use it as a custom Helper Method:  
[http://snippets.dzone.com/posts/show/804](http://snippets.dzone.com/posts/show/804)

---

<div class="post-metadata">

**Author:** ![jko170](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/d07c76/32.png) [@jko170](https://www.ruby-forum.com/u/jko170)\
**Post date:** [May 21, 2007, 7:37pm UTC](https://www.ruby-forum.com/t/block-of-text-method-to-make/104647/5 "2007-05-21T19:37:40Z")

</div>

Thanks for that snippit. I have been wanting to figure out how to do  
this  
and have been just too lazy to do it.
