Search code examples
htmlruby-on-railsrubyformtastic

Enable html on rails form using formtastic


I would like to enable html input from user on my form.

Tried: = f.input :body, :input_html => {:escape => false} and also {:disabled => false}

Right now the text shows up as a chunk.

if user puts:

Lorem Ipsum is simply dummy text `</br>` of the printing and typesetting industry.

should show up as:

Lorem Ipsum is simply dummy text
of the printing and typesetting industry.

Thank you so much for your help !!


Solution

  • Solved it.

    in form f.text_area

    added method on model

    def body_enable_html
      body.html_safe
    end
    

    and called method in views

    = @collection_page.body_enable_html