module Contingency::Adapters::Rails
Constants
- VERSION
Public Class Methods
included(base)
click to toggle source
# File lib/contingency/rails.rb, line 16 def self.included(base) base.extend(ClassMethods) end
Public Instance Methods
error_renderer(code)
click to toggle source
# File lib/contingency/rails.rb, line 20 def error_renderer(code) render Contingency.configuration.error_template, status: code, layout: Contingency.configuration.error_layout end
failure_renderer(code)
click to toggle source
# File lib/contingency/rails.rb, line 26 def failure_renderer(code) render status: code, text: Contingency.configuration.failure_message end
routing_error()
click to toggle source
Custom controller action. Raises traditional Rack-level Rails
RoutingError at Application-level instead, so it ‘rescue_from` in Contingency’s error handler can catch it instead of Rack’s. Works in conjunction with a catchall route pointed at this controller action.
# File lib/contingency/rails.rb, line 34 def routing_error raise ActionController::RoutingError, "No route matches [#{env['REQUEST_METHOD']}] #{env['PATH_INFO'].inspect}" end