https://rails.lighthouseapp.com/projects/8994/tickets/2582-actionviewtexthelper-graceful-truncate#ticket-2582-1
This could help, too! :P

On Mon, Mar 2, 2009 at 12:57 PM, andrew.ohns...@gmail.com <
andrew.ohns...@gmail.com> wrote:

>
> I have a text field in the db for the body of user posts.  Users
> submit the posts using the tinymce editor, which allows certain html
> tags.  The posts are stored in the db with allowed html tags directly
> in the post, so I could have something like:
>
> <p>This post will try to eliminate the confusion regarding rails and
> the truncate function.</p>
>
> I am trying to display the first 300 characters of the post on a
> "what's new" type page.  I am using the truncate function of rails to
> grab the first bit of each post for the what's new page...
>
> truncate(post.text, 300)
>
> which works just fine, except I have times where the 300 character
> limit hits in the middle of a tag.  One such post is currently
> screwing up my layout... the 300 character limit is hitting in the
> middle of the "close paragraph" tag, so my output html is:
>
> <p>This post will try to eliminate the confusion regarding rails and
> the truncate function.</
>
> Voiding the </div> that closes this area out.
>
> Simple ideas to fix this welcome... :)
> >
>


-- 
Emanuele Tozzato
+1 (619) 549 3230
1985 Sherington Place, #E302
Newport Beach, CA 92663
http://mekdigital.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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to