Forum: Ruby on Rails How to output unescaped string to console ?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Bob M. (Guest)
on 2009-02-19 18:17
Hi, whenever I display a string to the console (for debugging purpose) I
get a bunch of \\\\ '' """"

1) It's not human readable and really annoying when strings are very
2) Sometime it prevents me to debug anything as I really don't know if
my quotes or backslashes are ok

I must mention that I'm displaying on the fly generated javascript, so
the sense of my demand (could be applied to json generation to)

So, is there an helper method in Rails instead of just issuing p
my_script in my controller...

I thought about p unescape_rjs(my_script) but unescape_rjs is a
protected method of ActionController::Assertions::SelectorAssertions and
such, not available in the controller.

Any idea ?

Note : I could certainly gsub gsub gsub but I'm not sure I would catch
all the cases...
Bob M. (Guest)
on 2009-02-19 18:24
BTW, a simple javascript formatter could even be better - I often
struggle with RJS when I need to figure out the output render :update
This topic is locked and can not be replied to.