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. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
check the ruby docs for String. you could use scan or each or index and slice or split so many choices. raj wrote:> 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 used split and join...it worked for me. Thank you. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 - H On 5/22/07, raj <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > I used split and join...it worked for me. > > Thank you. > > -- > Posted via http://www.ruby-forum.com/. > > > >-- Husein Choroomi, CEO, CTO Yucca Intelligence Development http://www.YuccaHQ.com We make the web a better place! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---