diff --git a/lib/tapioca/dsl/compilers/action_controller_helpers.rb b/lib/tapioca/dsl/compilers/action_controller_helpers.rb index 376597bd3e..e51950674a 100644 --- a/lib/tapioca/dsl/compilers/action_controller_helpers.rb +++ b/lib/tapioca/dsl/compilers/action_controller_helpers.rb @@ -84,6 +84,13 @@ def decorate # Create helper method module controller.create_module(helper_methods_name) do |helper_methods| + # If the controller has the same helpers module as the superclass + # just include superclass helpers + if helpers_module == constant.superclass._helpers + superclass_helper_methods = constant.superclass.const_get(helper_methods_name) + next helper_methods.create_include(qualified_name_of(superclass_helper_methods)) + end + # If the controller has no helper defined, then it just inherits # the Action Controlller base helper methods module, so we should # just add that as an include and stop doing more processing. diff --git a/spec/tapioca/dsl/compilers/action_controller_helpers_spec.rb b/spec/tapioca/dsl/compilers/action_controller_helpers_spec.rb index c58631d32b..897e125807 100644 --- a/spec/tapioca/dsl/compilers/action_controller_helpers_spec.rb +++ b/spec/tapioca/dsl/compilers/action_controller_helpers_spec.rb @@ -160,13 +160,7 @@ class UserController def helpers; end module HelperMethods - include ::ActionController::Base::HelperMethods - - sig { returns(T.untyped) } - def current_user_name; end - - sig { params(user_id: ::Integer).void } - def notify_user(user_id); end + include ::BaseController::HelperMethods end class HelperProxy < ::ActionView::Base