roibcg
Last Updated: February 25, 2016
·
1.621K
· endorfin
4dc98ddeb0a2d3dcbe51f990ba696f04

Haml and the whitespace preservation problem with textarea and pre tags

Haml is to pretty-print your output in development. This wreaks havoc with preformatted text in pre and textarea tags. The first and simplest way is to just turn the pretty-printer off global by adding this haml.rb to your initializers

Haml::Template.options[:ugly] = true

You can also use a ~ instead of = in front of rails tag helper

.field
  ~ f.text_area :body, rows: 5
Say Thanks
Respond