ruby on rails - Converting HTML Entity to Raw HTML -
i have string:
'<div class="md"><p><a href="http://www.google.com/">foo</a></p> </div>'
which i'm trying display as:
foo
so i'm trying convert original string raw html.
i've tried:
raw '<div class="md"><p><a href="http://www.google.com/">foo</a></p> </div>'
which converts entity normal html displays string:
<div class="md"><p><a href="http://www.google.com/">foo</a></p> </div>
i've tried html_safe , html_safe.html_safe giving me same results.
so how convert string containing html entities raw html rendered in rails?
thanks
try this:
cgi.unescapehtml('<div class="md"><p><a href="http://www.google.com/">foo</a></p> </div>').html_safe
html ruby-on-rails
No comments:
Post a Comment