Debugging Haml

1,211 views
Skip to first unread message

Bharat

unread,
Mar 5, 2009, 7:44:11 AM3/5/09
to Boston Ruby Group
I got going with Haml awhile ago and converted the Insoshi application
to use Haml. For those who might be interested in using it as a
learning tool, here is the link on Github:

http://github.com/bruparel-test/insoshi_haml/tree/master

While I very much like the structure that Haml imposes on the views, I
do not know very much about debugging it in real-life scenarios. I
use NetBeans for my development work and it has a decent debugger
which has proven itself when debugging some messy views written by
previous programmers on a project that I worked on.

I would like to know how people debug their Haml templates? It is Ok
if you don't use an IDE but you probably have some tried and tested
techniques for debugging Haml. That is what I am interested in.

Thanks for your time.

Bharat

Josh Nichols

unread,
Mar 5, 2009, 12:26:41 PM3/5/09
to boston-r...@googlegroups.com
I generally try to avoid debugging templates if possible. If you're
doing something tricky, it might be worth putting it in a helper.

Otherwise, you can use ruby-debug (gem install ruby-debug) in the
middle of a haml template (or even a erb template):

- debugger

There's actually a screencast on using ruby-debug, so I'd suggest
looking at that for using it:
http://railscasts.com/episodes/54-debugging-with-ruby-debug

Bharat

unread,
Mar 5, 2009, 12:47:20 PM3/5/09
to Boston Ruby Group
Thanks Josh. I will go through the screencast. And you are right
about putting tricky stuff in helpers, much easier to debug that way.

Michael Breen

unread,
Mar 5, 2009, 1:25:11 PM3/5/09
to boston-r...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages