rails/rails · error · ArgumentError
helper must be a String, Symbol, or Module
Error message
helper must be a String, Symbol, or Module
What it means
Error "helper must be a String, Symbol, or Module" thrown in rails/rails.
Source
Thrown at actionpack/lib/abstract_controller/helpers.rb:43
self._helpers = define_helpers_module(self)
end
def _helpers
self.class._helpers
end
module Resolution # :nodoc:
def modules_for_helpers(modules_or_helper_prefixes)
modules_or_helper_prefixes.flatten.map! do |module_or_helper_prefix|
case module_or_helper_prefix
when Module
module_or_helper_prefix
when String, Symbol
helper_prefix = module_or_helper_prefix.to_s
helper_prefix = helper_prefix.camelize unless helper_prefix.start_with?(/[A-Z]/)
"#{helper_prefix}Helper".constantize
else
raise ArgumentError, "helper must be a String, Symbol, or Module"
end
end
end
def all_helpers_from_path(path)
helpers = Array(path).flat_map do |_path|
names = Dir["#{_path}/**/*_helper.rb"].map { |file| file[_path.to_s.size + 1..-"_helper.rb".size - 1] }
names.sort!
end
helpers.uniq!
helpers
end
def helper_modules_from_paths(paths)
modules_for_helpers(all_helpers_from_path(paths))
end
end
View on GitHub (pinned to 817fc2a147)
When it happens
Trigger: Thrown at actionpack/lib/abstract_controller/helpers.rb:43 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of rails/rails@817fc2a147 (2026-08-04).
Data as JSON: /data/errors/c3e58661f9bdaccf.json.
Report an issue: GitHub.