I want to allow a couple specific tags like (<br>
) but let rails continue to escape others. Html_safe does not appear to take any arguments. What's the smoothest way to do this?
The sanitize helper will html encode all tags and strip all attributes that aren’t specifically allowed.
sanitize @article.body, :tags => %w(br)
Link to API Docs.
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