Reputation: 1381
How to remove html tags from open graph description
meta property='og:description' content="#{@post.text}"
i have tried to add raw
and html_safe
to @post.text
but it doesn't help
raw(@post.text) ,@post.text.html_safe
Upvotes: 0
Views: 88
Reputation: 1283
You can use strip_tags to remove tags from a string.
strip_tags(@post.text)
raw
and html_safe
will escape html characters.
html_safe: http://edgeapi.rubyonrails.org/classes/String.html#method-i-html_safe
raw: http://api.rubyonrails.org/classes/ActionView/Helpers/OutputSafetyHelper.html#method-i-raw
Upvotes: 1