[英]Ruby on Rails Debug Question
Hello guys I have this video tutorial on Ruby on Rails and I see that the guy has a bottom script debug, in the browser window. 大家好,我有关于Ruby on Rails的视频教程,我看到这个人在浏览器窗口中有一个底部脚本调试。 The problem is, I have only one part of that video tutorial (that part is free) and he says nothing about that debug.
问题是,我只有该视频教程的一部分(该部分是免费的),他对该调试没有任何说明。 Maybe you guys can figure it out.
也许你们可以搞清楚。
Here's a screenshot with it: http://i55.tinypic.com/3537drp.png 这是一个截图: http : //i55.tinypic.com/3537drp.png
How can I achieve that? 我怎样才能做到这一点? Thanks.
谢谢。
In the view, doing something like 在视图中,做一些事情
<%= debug params %>
will achieve what you have shown. 将实现你所展示的。 Using the debug helper you can basically get a yaml dump of any variable that's available to the view, it will also "prettyfy" the dump by formatting it in a <pre> block and using a different background color.
使用调试帮助程序,您基本上可以获得视图可用的任何变量的yaml转储,它还可以通过在<pre>块中格式化并使用不同的背景颜色来“漂亮”转储。 From the looks of what he has, he might have added that to the bottom of a layout (might be in app/views/layouts/application.html.erb).
从他所拥有的外观来看,他可能已将其添加到布局的底部(可能位于app / views / layouts / application.html.erb中)。 That will give you that dump in any of your pages.
这将为您提供任何页面中的转储。
The Rails Footnotes gem is very easy to configure and includes information like: Rails Footnotes gem非常易于配置,包括以下信息:
Check it out: 看看这个:
https://github.com/josevalim/rails-footnotes https://github.com/josevalim/rails-footnotes
对于调试视图,您只需在视图页面中<%debugger%>,无论您想要查看数据流还是再次加载该视图,您都可以在控制台上运行每一行视图并查看数据流..并确保您在你的gem文件中有调试器gem。
看起来他只是将params.to_yaml
渲染到页面上。
您应该考虑使用--debugger标志运行rails,如本指南中所示: http : //guides.rubyonrails.org/debugging_rails_applications.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.