Last Updated: February 25, 2016
· endorfin

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

  ~ f.text_area :body, rows: 5