Warm tip: This article is reproduced from stackoverflow.com, please click
ruby-on-rails haml

What is the equivalent of for Haml?

发布于 2020-03-27 10:30:02

I have an annoying view problem that I'm trying to debug and no where on the Haml Documentation Haml Docs does it specify how to debug view code. This is very annoying and all I need is to debug a variable. Can someone please help me with this? Thank you.

Questioner
Dan Rubio
Viewed
81
Andrey Deineko 2016-05-30 05:27

In Haml, to print a result on the page, you use = sign, so in your case it is:

= @variable.inspect

To write a conditional statement, for instance if else, you would use -:

-if condition
  # logic
-else
  #logic

Note, there is no end.