Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Use the new respond_to API for dealing with non-HTML accepts in rende…

…r_404 and render_500
  • Loading branch information...
commit e8bb7f724acdba3b0157a1068bb85ebe7a600c0a 1 parent 93892e4
@jamis jamis authored
Showing with 8 additions and 2 deletions.
  1. +8 −2 lib/exception_notifiable.rb
View
10 lib/exception_notifiable.rb
@@ -54,11 +54,17 @@ def local_request?
end
def render_404
- render :file => "#{RAILS_ROOT}/public/404.html", :status => "404 Not Found"
+ respond_to do |type|
+ type.html { render :file => "#{RAILS_ROOT}/public/404.html", :status => "404 Not Found" }
+ type.all { render :nothing => true, :status => "404 Not Found" }
+ end
end
def render_500
- render :file => "#{RAILS_ROOT}/public/500.html", :status => "500 Error"
+ respond_to do |type|
+ type.html { render :file => "#{RAILS_ROOT}/public/500.html", :status => "500 Error" }
+ type.all { render :nothing => true, :status => "500 Error" }
+ end
end
def rescue_action_in_public(exception)
Please sign in to comment.
Something went wrong with that request. Please try again.