Thursday, November 30, 2006

RAILS: Printing out debug information

To have a constant printout of the session and params data, place the following code at the very bottom of the layout template(s):

<%= javascript_include_tag 'prototype' %>
<div style="color:#eee;font-size:10pt">
<% if ENV['RAILS_ENV'] == 'development' %>
<div id="debug" style="margin: 40px 5px 5px 5px;">
<a href="#" onclick="Element.toggle('debug_info');return false" style="text-decoration: none; color: #ccc;">Show Debug Info ➲</a>
<div id="debug_info" style="display : none;">
Session:<br>
<%= debug session %>
Params:<br>
<%= debug params %>
</div>
</div>
<% end %>
</div>