I have an article list page. It needs to show some content information about this article. If I only use:
truncate @article.content,:length=>100
It will show some html tag, and doesn't show the real content to the user. I want to find some way to get the text extract from the content, so I want to ask is there some embedded way to achieve this?
You could use strip_tags
to remove the html tags:
truncate(strip_tags(@article.content), :length=>100)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With