instance method
modules_for_helpers
Ruby on Rails 3.0.20
Since v3.0.20 PrivateSignature
modules_for_helpers(args)
Returns a list of modules, normalized from the acceptable kinds of helpers with the following behavior:
- String or Symbol
-
:FooBar or “FooBar” becomes “foo_bar_helper”,
and "foo_bar_helper.rb" is loaded using require_dependency.
- Module
-
No further processing
After loading the appropriate files, the corresponding modules are returned.
Parameters
-
args- An array of helpers
Returns
-
Array- A normalized list of modules for the list of helpers provided.
Parameters
-
argsreq
Source
# File actionpack/lib/abstract_controller/helpers.rb, line 143
def modules_for_helpers(args)
args.flatten.map! do |arg|
case arg
when String, Symbol
file_name = "#{arg.to_s.underscore}_helper"
require_dependency(file_name, "Missing helper file helpers/%s.rb")
file_name.camelize.constantize
when Module
arg
else
raise ArgumentError, "helper must be a String, Symbol, or Module"
end
end
end
Defined in actionpack/lib/abstract_controller/helpers.rb line 143
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in AbstractController::Helpers::ClassMethods