Tutorial: Debug a Rails Runner Script
The Rails runner allows you to run Ruby code in the Rails context non-interactively. In this tutorial, we'll show you how to debug a Rails runner script in RubyMine.
For example, your project contains the Ruby script you want to debug at the following path: lib/script.rb. Before debugging, you need to create a run/debug configuration for running this script using the Rails runner.
Create the Rails runner configuration
In the main menu, go to Gem Command from the list., click , and select
In the Run/Debug Configurations dialog, specify the following settings:
Name: Enter the run/debug configuration name, for example, rails runner.
Gem name: Specify the rails gem here.
Executable name: Select the rails executable.
Arguments: Specify arguments for running the script using the Rails runner:
Debug the Rails runner configuration
To debug the newly created rails runner configuration, do the following:
Set a breakpoint in the lib/script.rb file.
Press Ctrl twice and type the configuration name in the popup:
Press and hold down the Shift key (the dialog title changes to Debug) and press Enter. RubyMine will suspend the script execution before the breakpoint.