未定义的方法和路由错误需要花费大量时间
由于我将应用程序从 Rails 2.3.5 更新到 Rails 3,目前运行的是 3.2.1,未定义的方法和路由错误需要花费大量时间。每当我缺少某种方法时,我的 Macbook Pro 就会死机,3/4 分钟后我就会收到相应的错误。
当我有一个未定义的方法时,这里有一个完整的堆栈跟踪,奇怪的是,diagnostics.erb 需要 149863 毫秒才能加载,我猜这不正常:
https://gist.github.com/1778939
堆栈跟踪中应用程序级别的唯一调用是我的 method_missing application_controller.rb,这是我正在使用的方法:
def method_missing(method_id, *arguments)
# Define a authorize_type dynamic authorization thingiemagiggy
if match = /authorize_([_a-zA-Z]+)/.match(method_id.to_s)
return authorize(match[1])
else
super
end
end
我还将添加路由错误的堆栈跟踪,似乎视图需要很长时间才能加载,但此视图中只有一个链接:
https://gist.github.com/1779027
有人可以解释一下为什么启动这种错误需要这么长时间时间和我该如何修复它?
Since I updated my application from Rails 2.3.5 to Rails 3, currently running 3.2.1, undefined method and routing errors take a lot of time. Every time I have some method missing my Macbook Pro is freezing and after 3/4 minutes I get the corresponding error.
Here you have a full stack trace when I have an undefined method, the thing that is strange is that the diagnostics.erb takes 149863 ms to load, this is not normal I guess :
https://gist.github.com/1778939
The only call on application level that is in the stack trace is the method_missing in my application_controller.rb, here is the method I'm using :
def method_missing(method_id, *arguments)
# Define a authorize_type dynamic authorization thingiemagiggy
if match = /authorize_([_a-zA-Z]+)/.match(method_id.to_s)
return authorize(match[1])
else
super
end
end
I also will add a stack trace of a routing error, there it seems that the views take ages to load, but there is just a link to in this views:
https://gist.github.com/1779027
Somebody can explain me why the launching of this kind of errors takes so much time and how I can fix it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最后在github上的rails问题的帮助下找到了如何修复它:https://github。 com/rails/rails/issues/1525
我制作了一个初始化程序 anti_freeze.rb,其中包含:
Finally found out how to fix it with the help of the rails issue on github : https://github.com/rails/rails/issues/1525
I made an initializer anti_freeze.rb that contains :