If you’ve upgraded to Rails 5.2 and are using RubyMine’s debugger you might notice that breakpoints aren’t working as they should. For me, they would only work in views, but controllers and models wouldn’t stop anything.
Turns out the problem is the inclusion of the Bootsnap gem in Rails 5.2. Bootsnap is awesome so you probably want to use it, but having a broken debugger sucks. So let’s fix it.
Step 1 – Set an ENV variable for debugging in RubyMine
Run > Debug...
- Add an ENV variable to be included when the debugger boots Rails
ENV['DEBUG_MODE'] = true
Step 2 – Add conditional to
boot.rb and alter the bootsnap line like so
require 'bootsnap/setup' unless ENV['DEBUG_MODE']
Now, when you boot into development (or production) you get to take advantage of Bootsnap. But when you need to do some debugging you boot Rails without Bootsnap and your debugging functions like you think it should.