Rails:生产与开发中的错误

时间:2010-04-17 01:59:07

标签: ruby-on-rails

在Rails中,有没有办法在生产轨道服务器(一个漂亮的图形)和开发服务器(详细的错误信息,堆栈跟踪等)上显示不同的错误消息?

1 个答案:

答案 0 :(得分:4)

找到一个solution。在ApplicationController中,添加:

rescue_from Exception, :with => :rescue_all_exceptions if RAILS_ENV == 'production'

def rescue_all_exceptions(exception)
  case exception
    # do production-ey exception stuff
  end
end

我有兴趣听听其他选择......