This line overrides context.controller. https://github.com/rails/rails/blob/23956c7f94dffbddf257c0abb93231eb2be69d5e/actionpack/lib/action_controller/metal/instrumentation.rb#L60 `Rails.error.report` is executed here https://github.com/rails/rails/blob/23956c7f94dffbddf257c0abb93231eb2be69d5e/actionpack/lib/action_dispatch/middleware/executor.rb#L28 On development, it runs before rendering `RestfulController#show` but on production, the order switches. https://github.com/rails/rails/issues/51002