【发布时间】:2012-04-11 15:39:25
【问题描述】:
我在我的ApplicationController 上使用以下代码:
rescue_from ActiveRecord::RecordNotFound, :with => :not_found
def not_found
render :nothing => true, :status => :not_found
end
为了让 Rails 以正确的状态码响应而不引发异常 处于开发模式。
我知道how-to-handle-errors-like-404-500-in-rails3 解释了 Rails 如何在生产模式下工作。换句话说,我在开发模式下尝试做的事情是在生产模式下没有任何代码。
我怎样才能让开发模式表现得像生产模式一样,摆脱上面的代码?
请注意,我使用的是Rails 3.2.3
【问题讨论】: