fipa
July 27, 2010, 1:09am
1
Hi,
When rails raises an exception which file (view?) gets rendered and
outputs in the browser the backtrace, request, parameters, etc.
I’m asking that because I’d like to know if Rails provides an easy way
to convert a hash to a readable string, eg:
“{:key => ‘value’}” instead of yukky #to_s which gives “keyvalue”.
Thanks
fipa
July 27, 2010, 5:43pm
2
On Mon, Jul 26, 2010 at 19:09, Fernando P. [email protected]
wrote:
I’d like to know if Rails provides an easy way
to convert a hash to a readable string, eg:
“{:key => ‘value’}” instead of yukky #to_s which gives “keyvalue”.
Maybe you can override to_s?
-Dave
–
Specialization is for insects. -RAH | Have Pun, Will Babble! -me
Programming Blog: http://codosaur.us | Work: http://davearonson.com
Leadership Blog: http://dare2xl.com | Play: http://davearonson.net
fipa
July 27, 2010, 7:50pm
3
Fernando P. wrote:
Hi,
When rails raises an exception which file (view?) gets rendered and
outputs in the browser the backtrace, request, parameters, etc.
I’m asking that because I’d like to know if Rails provides an easy way
to convert a hash to a readable string, eg:
“{:key => ‘value’}” instead of yukky #to_s which gives “keyvalue”.
Are you looking for something like p or inspect ?
Thanks
Best,
Marnen Laibow-Koser
http://www.marnen.org
[email protected]
fipa
August 15, 2010, 6:16pm
4
I think I’m experiencing an issue with Hash#inspect: if one of the
values holds a file, it seems Ruby keeps it as a file, so I’ll let you
guess what may happen if the file is a bit big when I just expect a
little string to represent that file…
fipa
July 27, 2010, 10:46pm
5
Are you looking for something like p or inspect ?
Damn’ it! I completely forgot about Hash#inspect! Thanks Marnen
fipa
August 16, 2010, 6:01pm
6
Fernando P. wrote:
I think I’m experiencing an issue with Hash#inspect: if one of the
values holds a file, it seems Ruby keeps it as a file, so I’ll let you
guess what may happen if the file is a bit big when I just expect a
little string to represent that file…
So check for File values. What’s the problem?
Best,
Marnen Laibow-Koser
http://www.marnen.org
[email protected]