instance method controller_class_for

Ruby on Rails 8.1.2

Since v5.2.8.1

Available in: 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

controller_class_for(name)

No documentation comment.

Parameters

name req
Source
# File actionpack/lib/action_dispatch/http/request.rb, line 93
    def controller_class_for(name)
      if name
        controller_param = name.underscore
        const_name = controller_param.camelize << "Controller"
        begin
          const_name.constantize
        rescue NameError => error
          if error.missing_name == const_name || const_name.start_with?("#{error.missing_name}::")
            raise MissingController.new(error.message, error.name)
          else
            raise
          end
        end
      else
        PASS_NOT_FOUND
      end
    end

Defined in actionpack/lib/action_dispatch/http/request.rb line 93 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActionDispatch::Request

Type at least 2 characters to search.

↑↓ navigate · open · esc close