Debug a Rails Request in RubyMine: Conditional Breakpoints and Variable Inspection
Configure RubyMine's built-in Ruby debugger for a Rails request, bind conditional breakpoints, inspect frames and variables, and verify the debug gem backend before starting a session.
25 Feb 2026, 10:11 UTC

Desired Outcome
Suspend a Rails controller action at a specific line only when a condition is true, inspect the call stack and variables, step through the method, and resume without restarting the server.
Prerequisites
- RubyMine 2023.3 or later with the Ruby plugin enabled.
- A Rails project using Ruby 3.1+ with the
debuggem in theGemfile, or an older Ruby withbyebuganddebase. - Bundler has installed gems for the Ruby SDK selected in Settings → Languages & Frameworks → Ruby SDK and Gems.
- Port
12345is free on localhost for the debugger connection.
Verify the Debugger Backend
RubyMine loads the debugger backend from the Bundler environment tied to the project SDK. Confirm it before creating a run configuration.
- Open Settings → Build, Execution, Deployment → Debugger → Ruby.
- Check that Debugger backend lists
debugfor Ruby 3.1+, orbyebug/debasefor older runtimes. - If it shows No debugger found, run
bundle installin the RubyMine terminal and restart the IDE.
# Run in RubyMine's built-in terminal
bundle list | grep -E 'debug|byebug|debase'
# Expected: debug (>= 1.7) on Ruby 3.1+, or byebug/debase on older runtimes
If the gem is absent, add it to the development group in Gemfile and run bundle install again.
Create a Rails Debug Configuration
- Open the run configuration dropdown in the top toolbar and choose Edit Configurations…
- Click +, select Rails, and name it
Rails Debug. - Set Server to
Puma, Port to3000, and Environment todevelopment. - Leave Run in debug mode enabled.
- Apply the configuration.
Set a Conditional Breakpoint
Open the controller file. Click the gutter next to an executable line to create a line breakpoint. Right-click the red dot and choose Condition. Enter a Ruby expression that must be true for suspension, such as params[:id] == '42'. The dot remains red but only triggers when the condition matches.
To log a value without suspending, right-click the breakpoint and choose Log expression, then enter @user.inspect or another expression.
Start Debugging and Hit the Breakpoint
- Select the
Rails Debugconfiguration. - Click Debug (Shift+F9). Wait for the debugger to report it is listening on the configured port.
- Use a browser or
curl http://localhost:3000/users/42to request the route. - When the condition is true, execution suspends. The Frames pane shows the call stack, and the Variables pane lists local, instance, and class variables for the selected frame.
Inspect and Step Through
- Inline values appear beside variables in the editor when enabled under Settings → Build, Execution, Deployment → Debugger → Data Views → Show values inline.
- Watches: add arbitrary expressions such as
session[:user_id]to the Watches tab. - Step actions:
- F8 Step Over — advance to the next line in the current frame.
- F7 Step Into — enter the called method.
- Shift+F8 Step Out — return to the caller.
- Alt+Shift+F7 Force Step Into — enter code in gems or the standard library.
- Drop Frame — right-click a frame in the Frames pane to rewind to its caller without re-executing the request.
- Evaluate Expression (Alt+F8) runs Ruby code in the current binding while suspended.
Expected Checks
- The Frames pane contains the controller action and at least one caller frame.
- The Variables pane shows
params,@user, or other expected objects with current values. - Pressing F8 moves the execution pointer to the next executable line.
- Pressing F9 resumes the request and returns an HTTP response to the client.
Common Failure Modes and Recovery
| Symptom | Likely Cause | Recovery |
|---|---|---|
| Breakpoint never suspends (hollow red dot) | Debugger gem missing or version mismatch with the Ruby SDK | Run bundle list | grep debug in the RubyMine terminal. Install the missing gem and restart RubyMine. |
| Request hangs or times out | Debugger suspension blocks the Puma thread; reverse proxies or health checks exceed their timeout | Increase the proxy read timeout or temporarily disable health checks. Keep debugging sessions brief. |
Cannot connect to debugged process |
Port 12345 is occupied or localhost is blocked |
Change the debugger port under Settings → Build, Execution, Deployment → Debugger → Ruby and confirm localhost resolves to 127.0.0.1. |
| Variables read as unavailable | Ruby JIT is enabled and interferes with frame introspection | Disable JIT for the debug session by clearing --jit from RUBYOPT in the run configuration environment variables. |
| Sidekiq job is not debugged | A Rails server configuration only attaches to the web process, not background workers | Create a separate Ruby run configuration for bundle exec sidekiq, enable debug mode, and use a distinct debugger port. |
Limitations
- Suspending the debugger pauses all threads in the process, so other concurrent requests stall in a multi-threaded server.
- Attaching the debugger can slow a large Rails application; avoid debugging under production-like load.
- Breakpoints are stored in the
.ideaworkspace and are user-local unless you commit workspace files, which is not recommended. - Remote or Docker debugging requires port forwarding and matching debugger gem versions on both ends; this guide covers local debugging only.
Quick Verification Checklist
bundle list | grep debugreturns a debugger backend gem.- Settings → Debugger → Ruby lists the same backend.
- A conditional breakpoint in
UsersController#showsuspends only when the condition matches. - The Frames pane shows
showand its caller. - The Variables pane displays
paramsand controller instance variables. - F8 steps to the next line; F9 resumes and the browser receives a response.
When all six checks pass, RubyMine is correctly configured to debug Rails requests.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.