BenMorganIO
BenMorganIO

Reputation: 2046

HTML Not Rendering over API in Rails

This is a cool problem. I have some videos on Wistia. I ask for the videos and I embed them into the site. That was fun. Now I want to grab the description. This is what I got:

<p> This is a description.</p>

I was expecting those <p> tags not to actually render as HTML. I'm assuming this is for security reasons.

One solution is to remove the tags with a reg ex and wrap around manually. Does anyone have any other ideas?

Upvotes: 1

Views: 34

Answers (1)

emcanes
emcanes

Reputation: 1398

Guess you could just sanitize it:

in a controller:

ActionController::Base.helpers.sanitize st, tags: %w()

in a view you can just

<%= sanitize st, tags: %w() %>

Upvotes: 1

Related Questions