How to get awesome_print to work in pry/ruby-debug in running app

混江龙づ霸主 提交于 2020-01-13 20:34:26

问题


I super love awesome_print and ruby-debug but I can't get them to work together. AwesomePrint returns HTML for formatting but I'd it seems like ruby-debug and pry don't like multi-line output so I always end up with a complete mess. This is what it looks like when I run ap from pry or ruby-debug (in a running app).

pry(#<#<Class:0x000001117f2f58>:0x000001117ef560>)> ap @user
=> "#<User:0x000001111de888> {\n<pre>:id</pre><pre> =&gt; </pre>\n ... snip ...}"

Has anyone had any luck getting awesome_print to work in ruby-debug or pry on a running rails app? Am I just doing something wrong? I would also be happy with multi-line pp, at least that would be a huge upgrade.

Thanks!


回答1:


Specify awesome_print in your Gemfile. Bundler runs things in its own context (not exactly know how or why this is done)



来源:https://stackoverflow.com/questions/6736315/how-to-get-awesome-print-to-work-in-pry-ruby-debug-in-running-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!