Monday, March 17, 2008

Debugging ERB Rendering In Rails

I had a helluva time figuring out that attempting to output a scriptlet that begins a block segment causes ERB to generate bad ruby code. Here's an example:
1 <%= tag_with_body do %><%end%>

What I really needed was a way to dump the generated ruby code from ERB. Turns out you can. On the last line of my controller action I added the following:
1 puts @__erbout

No comments: