Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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. 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

How can I achieve that? Thanks.

like image 411
Vlad.P Avatar asked Dec 04 '10 17:12

Vlad.P


2 Answers

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. 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). That will give you that dump in any of your pages.

like image 106
Roadmaster Avatar answered Sep 29 '22 12:09

Roadmaster


The Rails Footnotes gem is very easy to configure and includes information like:

  • variable assignments
  • params action / controller
  • route information
  • SQL statements & execution times

Check it out:

https://github.com/josevalim/rails-footnotes

like image 24
port5432 Avatar answered Sep 29 '22 14:09

port5432