Rails应用程序需要很长时间才能生成错误页面

max*_*axs 7 performance ruby-on-rails

我的Rails应用程序生成错误页面非常缓慢(Rail 3.1/3.2,ruby 1.9.2/1.9.3).例如,我已将my_bad_variable添加到某个.haml模板中

Rendered fees/index.html.haml within layouts/application (97752.1ms) Completed 500 Internal Server Error in 99579ms

ActionView::Template::Error (undefined local variable or method `my_bad_variable' for #<#:0x00000003bbf0c8>):

Completed 200 OK in 327ms (Views: 274.7ms | ActiveRecord: 9.8ms)

Rendered fees/index.html.haml within layouts/application (97752.1ms) Completed 500 Internal Server Error in 99579ms

ActionView::Template::Error (undefined local variable or method `my_bad_variable' for #<#:0x00000003bbf0c8>):

删除这个假变量后:

Completed 200 OK in 327ms (Views: 274.7ms | ActiveRecord: 9.8ms)

有什么建议?

小智 5

当我升级到rails 3.2时遇到了这个问题.我添加了这个初始化程序来修复它:

module ActionDispatch
  module Routing
    class RouteSet
      alias :inspect :to_s
    end
  end
end
Run Code Online (Sandbox Code Playgroud)

我认为这与ree有关.你在用ree吗?