Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the equivalent of <% debug @variable %> for Haml?

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.

like image 645
Dan Rubio Avatar asked Jan 21 '15 16:01

Dan Rubio


People also ask

How do you debug Byebug?

wherever you'd like the application to "break" - that is, executing byebug is equivalent to putting a breakpoint in your code. Run the program and use the debugger commands once you reach the breakpoint. near the end. Restart your server.


1 Answers

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.

like image 99
Andrey Deineko Avatar answered Oct 12 '22 23:10

Andrey Deineko