Quick and dirty debug logging in ruby on rails

Typically I just to render :text=> "Yo the value is #{debug_me}" and return

But sometimes this doesn't work. Maybe you are in a model file, or a method that gets returned to another method. If that is the case you can always get some debug by raising an exception:

raise "Yo the value is#{debug_me}"

Since exceptions can come from anywhere this will always works. There are other options, like using logger which works pretty well too - but raising an exception is a nice debug hack for your toolkit.

1 Response to Quick and dirty debug logging in ruby on rails

  1. www sunpokercom com...

    align:stopgap bridled ambushes,rouses ...

Post a Comment