Reputation: 5411
I'm making my own blog with ruby on rails. But when I create a field for the content in the form, I can only show plain text. How can I show an html text from my field content.
Thanks
Upvotes: 0
Views: 658
Reputation: 3773
In controller:
@some_variable = "<p>Hi there</p>"
In the view:
<%= @some_variable.html_safe %>
html_safe tells rails that your string is ok to display without escaping it first.
Upvotes: 1