Module: PricingPlans::ControllerRescues

Defined in:
lib/pricing_plans/controller_rescues.rb

Overview

Default controller-level rescues for a great out-of-the-box DX. Included automatically by the engine into ActionController::Base and ActionController::API. Applications can override by defining their own rescue_from handlers.

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/pricing_plans/controller_rescues.rb', line 8

def self.included(base)
  # Install a default mapping for FeatureDenied → 403 with helpful messaging.
  if base.respond_to?(:rescue_from)
    base.rescue_from(PricingPlans::FeatureDenied) do |error|
      handle_pricing_plans_feature_denied(error)
    end
  end
end