Forum: Ruby on Rails trimming the text....

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
F3756de5b120eaa1abfd1f913b35541b?d=identicon&s=25 raj (Guest)
on 2007-05-22 02:46
I have to display a post but i want to display only 3 lines of it......I
want to trim the text and put read more link.

How do i do that?

Thank you.

PS: New Bee to rails.
3df67e886c0d8151475beadad0a884fd?d=identicon&s=25 Sean T Allen (Guest)
on 2007-05-22 03:25
(Received via mailing list)
check the ruby docs for String.

you could use scan
or each
or index and slice
or split

so many choices.
F3756de5b120eaa1abfd1f913b35541b?d=identicon&s=25 raj (Guest)
on 2007-05-22 20:51
 I used split and worked for me.

Thank you.
6b554084eb8bcb53a1c97864d8c4ca0d?d=identicon&s=25 Husein Choroomi (Guest)
on 2007-05-23 02:21
(Received via mailing list)
You might also want to check Rails TextHelper, which has some useful
methods like excerpt, truncate, etc for manipulation strings.

- H

On 5/22/07, raj <> wrote:
>  I used split and worked for me.
> Thank you.
> --
> Posted via
> >

Husein Choroomi,
Yucca Intelligence Development

We make the web a better place!
This topic is locked and can not be replied to.