Skip to content

Commit

Permalink
actionpack: Do not redefine ActionController::Base.rescue_from
Browse files Browse the repository at this point in the history
`.rescue_from` method is defined in `ActiveSupport::Rescuable::ClassMethods`. Therefore
it would be better to extend it instead of redefinition.
  • Loading branch information
tk0miya committed Oct 23, 2023
1 parent 3e93a59 commit 501185c
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions gems/actionpack/6.0/actioncontroller.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,8 @@ module ActionController
def flash: () -> untyped
end

interface _API_and_Base_singletion
def rescue_from: (*Class, ?with: Symbol | Proc) -> void
| (*Class) { (Exception) -> void } -> void
end

class Base < Metal
include _API_and_Base
extend _API_and_Base_singletion

# https://github.com/rails/rails/blob/v6.0.3.2/actionpack/lib/action_controller/base.rb#L205-L255
include AbstractController::Rendering
Expand Down Expand Up @@ -59,6 +53,8 @@ module ActionController
include AbstractController::Callbacks
extend AbstractController::Callbacks::ClassMethods
include Rescue
include ActiveSupport::Rescuable
extend ActiveSupport::Rescuable::ClassMethods
include Instrumentation
extend Instrumentation::ClassMethods
include ParamsWrapper
Expand All @@ -67,7 +63,6 @@ module ActionController

class API < Metal
include _API_and_Base
extend _API_and_Base_singletion

# https://github.com/rails/rails/blob/v6.0.3.2/actionpack/lib/action_controller/api.rb#L112-L145
include AbstractController::Rendering
Expand All @@ -87,6 +82,8 @@ module ActionController
include AbstractController::Callbacks
extend AbstractController::Callbacks::ClassMethods
include Rescue
include ActiveSupport::Rescuable
extend ActiveSupport::Rescuable::ClassMethods
include Instrumentation
extend Instrumentation::ClassMethods
include ParamsWrapper
Expand Down

0 comments on commit 501185c

Please sign in to comment.