Search code examples
ruby-on-rails-4summernotetrix

Trix and Summer Note issues while content saving in database


I am building a rails blog and I needed to integrate a WYSIWYG editor so I tried with Summernote (v 0.8.1.1), everything is fine except when I create a new post , content is being saved into the database along with html tags instead of only the formatted text content. Latter I tried with Trix (v 0.10.1) and the same thing is happening.I followed everything correctly from the github docs but this only one issue persists. Thank you in advance.

This is the screen shot of the issue:screenshot


Solution

  • When you display data on page use raw like:

    raw(@data)
    

    which will convert yout html tags to proper html on page.