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.
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.
check the ruby docs for String.
you could use scan
or each
or index and slice
or split
so many choices.
I used split and join…it worked for me.
Thank you.
You might also want to check Rails TextHelper, which has some useful
methods like excerpt, truncate, etc for manipulation strings.
http://api.rubyonrails.com/classes/ActionView/Helpers/TextHelper.html
On 5/22/07, raj [email protected] wrote:
I used split and join…it worked for me.
Thank you.
–
Posted via http://www.ruby-forum.com/.
–
Husein C.,
CEO, CTO
Yucca Intelligence Development
We make the web a better place!
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs