Skip to content

Instantly share code, notes, and snippets.

@tarot
Created November 26, 2015 14:34
Show Gist options
  • Save tarot/5405778d2f2b145a24bd to your computer and use it in GitHub Desktop.
Save tarot/5405778d2f2b145a24bd to your computer and use it in GitHub Desktop.
class ApplicationController < ActionController::Base
rescue_from StandardError, with: :error500
def error500
respond_to do |format|
format.json { render json: {message: 'Internal Server Error'}, status: :internal_server_error }
# ↓こいつのContent-Typeをtext/htmlに固定したい
format.any { render 'error500', formats: :html, status: :internal_server_error }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment