This repository has been archived on 2020-05-27. You can view files and clone it, but cannot push or open issues/pull-requests.
2008-10-01 02:19:35 -04:00
|
|
|
class Exceptions < Application
|
|
|
|
# handle NotFound exceptions (404)
|
|
|
|
def not_found
|
2008-10-11 04:22:58 -04:00
|
|
|
do_your_render_thing
|
2008-10-01 02:19:35 -04:00
|
|
|
end
|
2008-10-17 03:51:13 -04:00
|
|
|
|
2008-10-01 02:19:35 -04:00
|
|
|
# handle NotAcceptable exceptions (406)
|
|
|
|
def not_acceptable
|
2008-10-11 04:22:58 -04:00
|
|
|
do_your_render_thing
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def do_your_render_thing
|
|
|
|
if request.xhr?
|
|
|
|
render :format => :html, :layout => false
|
|
|
|
else
|
2008-10-17 03:51:13 -04:00
|
|
|
render_and_notify :format => :html
|
2008-10-11 04:22:58 -04:00
|
|
|
end
|
2008-10-01 02:19:35 -04:00
|
|
|
end
|
|
|
|
end
|