amatsuda/active_decorator

Bug when using ActionController::API

Closed this issue · 2 comments

Here's the backtrace.
https://gist.github.com/rainerborene/b0906fbfd75ef6f028935ce73d576fa7

And here's the solution:

# 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
        end
      end
    end
  end
end

@amatsuda can you plz release a new patched version if this bug is confirmed?

@rainerborene This issue has been finally fixed via #106. Thanks!