Skip to content

Rails Debugging Print

Arturo Pie edited this page Jul 28, 2015 · 6 revisions

Rationale

When debugging a Rails application one of the best techniques is to insert print statements into the server log. To make the debugging print statement standout in the log it's useful to display a prompt prior to the debugging output. We can make this common operation easier by adding a live template just for this purpose.

Mechanism

Navigate to: RubyMine > Preferences > Editor > Live Templates

New Live Template

![Debugging Print Live Template](https://github.com/amckinnell/RubyMineTips/blob/master/images/debugging-print-live-template .png)

Click "Edit variables"

Debugging Print Edit Template Variables

Now, when you are debugging and want to print the value of some variable:

  1. copy the variable name
  2. put the cursor on the line where you want to know the value of that variable
  3. type pp and press Enter (or your expand live template key)

Debugging Print Example

Clone this wiki locally