500.html以外を表示したい場合。
# /lib/exceptions.rb
module Exceptions
class PaymentGatewayError < StandardError; end
end
# /app/controllers/application_controller.rb
class ApplicationController < ActionController::Base
rescue_from Exceptions::PaymentGatewayError do |exception|
render(:file => "#{Rails.root}/public/payment_error", :layout => false, :status => 500)
end
end
# /public/payment_error.html
<html><body>決済エラー</body></html>
これでraise Exceptions::PaymentGatewayErrorとかってやるとpayment_error.htmlが表示される。