instance method modules_for_helpers

Ruby on Rails 3.1.12

Since v3.0.20

Available in: v3.0.20 v3.1.12 v3.2.22.5 v4.0.13 v4.1.16 v4.2.9 v5.2.8.1 v6.0.6 v6.1.7.10 v7.0.10 v7.1.6 v7.2.3 v8.0.4 v8.1.2

Signature

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

args req
Source
# File actionpack/lib/abstract_controller/helpers.rb, line 130
      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 130 · View on GitHub · Improve this page · Find usages on GitHub

Defined in AbstractController::Helpers::ClassMethods

Type at least 2 characters to search.

↑↓ navigate · open · esc close