Rails: Using Tilde in HAML

I just came across this line in the form of HAML / Rails:

~ f.input :content, label: false

What does tilde do?

+4
source share
1 answer

Saving spaces: ~ :

~It works the same way =, except that it starts Haml::Helpers#find_and_preserveon its tab. For instance,

~ "Foo\n<pre>Bar\nBaz</pre>"

matches with:

= find_and_preserve("Foo\n<pre>Bar\nBaz</pre>")

and compiled for:

Foo <pre>Bar&#x000A;Baz</pre>

+4
source

Source: https://habr.com/ru/post/1662402/


All Articles