Search code examples
htmlruby-on-railsdatabasehtml-safe

html_safe not working on the input fields text in rails


I have tried to display text in input field like text_area but here text data is not plain text and it has some html tags also.

Ex:-

'<%= f.text_area :email_message, :value => "#{@message}".html_safe %>'

I have used html_safe for this text to avoid tags and get html formatting effect but no success.

Hope we need to use text editor for this kind of text display.

Is there any idea to achieve it without text editor in rails..?

Please share your comments/ideas.

Thanks in advance.


Solution

  • You can't put html in a text area.