加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails – 为什么Ruby 2.5.0在Rails 5.1.4中没有显示堆栈

发布时间:2020-12-17 04:14:35 所属栏目:百科 来源:网络整理
导读:以下是Rails服务器日志的两个示例,用于在仅更改 Ruby版本时遇到的错误. Ruby 2.4.2,Rails 5.1.4,Puma 3.11.0: NoMethodError - undefined method `recent' for #Event:0x00007f08507bf8b8: path/to/show.html.haml:50:in `block in _path_to_show_html_haml
以下是Rails服务器日志的两个示例,用于在仅更改 Ruby版本时遇到的错误.

Ruby 2.4.2,Rails 5.1.4,Puma 3.11.0:

NoMethodError - undefined method `recent' for #<Event:0x00007f08507bf8b8>:
  path/to/show.html.haml:50:in `block in _path_to_show_html_haml___4224769623360811234_28796540'
  path/to/show.html.haml:30:in `_path_to_show_html_haml___4224769623360811234_28796540'

Ruby 2.5.0,Puma 3.11.0:

NoMethodError - undefined method `recent' for #<Event:0x00007f8ccc1b9508>:

如何在Rails日志中重新启用堆栈跟踪?看起来没有办法查看要查看的文件/行号.

为了帮助调查,我将其添加到我的ApplicationController中:

rescue_from Exception do |exception|
  byebug
  1+1
end

Ruby 2.4.2

(byebug) exception.backtrace
# A very large array of paths appears

Ruby 2.5.0

(byebug) exception.backtrace
nil

解决方法

Gemfile中的binding_of_caller gem已过期.我从0.7.3升级到0.8.0,问题就消失了.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读