binding_of_caller REPL不会在更好的错误中触发

Tyc*_*cho 5 ruby-on-rails better-errors-gem

我有一个使用Better Errors的Rails应用程序,但错误页面不会加载binding_of_caller交互式shell(REPL).相反,它仍然只显示:

Tip: add gem "binding_of_caller" to your Gemfile to enable the REPL and local/instance variable inspection.
Run Code Online (Sandbox Code Playgroud)

我的Gemfile有:

group :development, :test do
    gem 'debugger'
    gem 'better_errors'
    gem 'binding_of_caller' #, :platforms=>[:mri_19, :mri_20, :rbx]
Run Code Online (Sandbox Code Playgroud)

我试过的最后一部分是注释还是未注释.在Rails控制台中尝试"require'binding_of_caller'"时,它返回false而不是错误,这意味着它已正确加载.Gemfile.lock显示以下版本:

rails (4.1.0.rc2)
better_errors (1.1.0)
  coderay (>= 1.0.0)
  erubis (>= 2.6.6)
binding_of_caller (0.7.2)
  debug_inspector (>= 0.0.1)
Run Code Online (Sandbox Code Playgroud)

可能有什么问题?我应该提供哪些其他代码才能找到出错的线索?

小智 0

检查是否:

config.consider_all_requests_local = true
Run Code Online (Sandbox Code Playgroud)

在您的 config/environments/development.rb 中设置

另外,如果您使用的是 sublime 编辑器,您可以添加:

BetterErrors.editor = :sublime if defined? BetterErrors
Run Code Online (Sandbox Code Playgroud)

在您的 config/initializers 文件夹中命名文件“better_errors.rb”

让我知道这是否有帮助?