开发者

What is the Exception class to use in rescue_from to catch 422 errors?

I am trying to display a custom 422 page in my application. What is the Exception class I am supposed to catch in the rescue_from declaration?

This how I handle the RecordNotFound exceptions:

开发者_JAVA技巧
rescue_from ActiveRecord::RecordNotFound,  :with => :render_404


Well, there is a list that maps the exception class with appropriate status code. You go through this documentation. In your case, there are three: ActiveRecord::RecordInvalid, ActiveRecord::RecordNotSaved, and ActionController::InvalidAuthenticityToken.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜