获取nil的未定义方法"+":仅使用RubyMine调试器启用NilClass

Paw*_*uda 12 ruby debugging ruby-on-rails intellij-idea rubymine

我的环境:

Ubuntu 14
Ruby 2.2.1
Rails 4.2
Run Code Online (Sandbox Code Playgroud)

新创建的rails应用程序,具有1个操作:

class FramesController < ApplicationController
  def index
    return 0
  end
end
Run Code Online (Sandbox Code Playgroud)

无论我在哪里放置一个断点(在返回0的情况下),我在浏览器中收到此错误:

undefined method `+' for nil:NilClass
Run Code Online (Sandbox Code Playgroud)

只有当我在RubyMine中使用'Debug'选项并且到达断点时才会发生这种情况.当我在没有调试器/断点的情况下运行服务器时,一切正常.

daw*_*wez 25

我有同样的问题,只是byebug gemGemfile中删除修复它

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  #gem 'byebug'
Run Code Online (Sandbox Code Playgroud)

检查Gemfile中是否有byebug,以防万一.

使用Intellij Idea 14.1进行测试,也应该适用于RubyMine

  • 安装了"pry-byebug".从Gemfile中删除它为我修复了同样的错误 (2认同)