Jonathan Clark
Jonathan Clark

Reputation: 20538

How to strip away empty paragraph tags

I am building an Rails 5 app. In this app I am receiving html data from a WYSIWYG-form. In the content from the form I get a lot of empty

tags, how can I remove all these empty paragraph tags?

This is what I get:

<p></p>

Upvotes: 0

Views: 116

Answers (1)

Thomas R. Koll
Thomas R. Koll

Reputation: 3139

If this is really the only thing you want to scrub:

content.gsub('<p></p>', '')

Upvotes: 1

Related Questions