Search code examples
ruby-on-railsrubydebuggingintellij-idearubymine

Getting undefined method `+' for nil:NilClass only with RubyMine debugger on


My environment:

Ubuntu 14
Ruby 2.2.1
Rails 4.2

Newly created rails application, with 1 action:

class FramesController < ApplicationController
  def index
    return 0
  end
end

Wherever I put a breakpoint (in presented case at return 0), I get this error in my browser:

undefined method `+' for nil:NilClass

It only happens when I use the 'Debug' option in RubyMine and when a breakpoint is reached. When I run the server without debugger/breakpoints, everything works fine.


Solution

  • I had the same issue, and just removing the byebug gem from the Gemfile fixed it

    group :development, :test do
      # Call 'byebug' anywhere in the code to stop execution and get a debugger console
      #gem 'byebug'
    

    Check if you have the byebug in the Gemfile and in case disable it.

    Tested with Intellij Idea 14.1, should also apply to RubyMine