Sha256: fa242267eb300640b803ba6b7730bcbe0db9378ea4796e50b02e5cd282ad0118

Contents?: true

Size: 504 Bytes

Versions: 5

Compression:

Stored size: 504 Bytes

Contents

# frozen_string_literal: true

# A monkey-patch for Action Controller to pass the controller view_context over
# to `render` invocation in `rescue_from` block.
module ActiveDecorator
  module Monkey
    module ActionController
      module Base
        def rescue_with_handler(*)
          ActiveDecorator::ViewContext.push(view_context) if defined?(view_context)
          super
        ensure
          ActiveDecorator::ViewContext.pop if defined?(view_context)
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
active_decorator-1.4.1 lib/active_decorator/monkey/action_controller/base/rescue_from.rb
active_decorator-1.4.0 lib/active_decorator/monkey/action_controller/base/rescue_from.rb
active_decorator-1.3.4 lib/active_decorator/monkey/action_controller/base/rescue_from.rb
active_decorator-1.3.3 lib/active_decorator/monkey/action_controller/base/rescue_from.rb
active_decorator-1.3.2 lib/active_decorator/monkey/action_controller/base/rescue_from.rb