Re: [Feature][ActionView]Add :strip_tags option to truncate helper
Hey, thanks for answer! But it doesn't really do what I meant with :strip_tags option.
The idea is to strip HTML tags before text gets truncated. Of course, you can just pass stripped text to truncate, like truncate(strip_tags(content)), but i think it will be nice to have this as an option in truncate method, since it's already have :escape anyway.
My idea is kind of inspired by ActionText in Rails 6, I was thinking about real life use cases for truncate method, and realized that most of the time it will be dealing with rich text in some way: blog posts, articles, etc
On Friday, October 26, 2018 at 2:27:24 AM UTC+3, Andrew Kaspick wrote:
I think the proper way to do what you want is....
content_tag(:p, truncate("Once upon a time in a world far far away"))