class ActionDispatch::Routing::RouteSet
Experimental RBS support (using type sampling data from the type_fusion
project).
# sig/action_dispatch/routing/route_set.rbs class ActionDispatch::Routing::RouteSet def add_route: (ActionDispatch::Routing::Mapper::Mapping mapping, String name) -> ActionDispatch::Journey::Route def call: (Hash env) -> Array[Integer] def find_relative_url_root: (Hash options) -> nil def find_script_name: (Hash options) -> String def generate: (String route_name, Hash options, ?Hash recall, ?nil method_name) -> ActionDispatch::Journey::Formatter::RouteWithParams def make_request: (Hash env) -> ActionDispatch::Request def mounted_helpers: () -> Module def optimize_routes_generation?: () -> true def optimize_routes_generation?: () -> true def optimize_routes_generation?: () -> true def relative_url_root: () -> nil def request_class: () -> Class def url_for: (Hash options, ?String route_name, ?Proc url_strategy, ?Symbol method_name, ?Array[Symbol] reserved) -> String def url_for: (Hash options, ?String route_name, ?Proc url_strategy, ?Symbol method_name, ?Array[Symbol] reserved) -> String def url_helpers: (?true supports_path) -> Module end
:stopdoc:
def self.default_resources_path_names
def self.default_resources_path_names { new: "new", edit: "edit" } end
def self.new_with_config(config)
def self.new_with_config(config) route_set_config = DEFAULT_CONFIG # engines apparently don't have this set if config.respond_to? :relative_url_root route_set_config.relative_url_root = config.relative_url_root end if config.respond_to? :api_only route_set_config.api_only = config.api_only end new route_set_config end
def _routes; @_proxy._routes; end
def _routes; @_proxy._routes; end
def add_polymorphic_mapping(klass, options, &block)
def add_polymorphic_mapping(klass, options, &block) @polymorphic_mappings[klass] = CustomUrlHelper.new(klass, options, &block) end
def add_route(mapping, name)
Experimental RBS support (using type sampling data from the type_fusion
project).
def add_route: (ActionDispatch::Routing::Mapper::Mapping mapping, String name) -> ActionDispatch::Journey::Route
This signature was generated using 1 sample from 1 application.
def add_route(mapping, name) raise ArgumentError, "Invalid route name: '#{name}'" unless name.blank? || name.to_s.match(/^[_a-z]\w*$/i) if name && named_routes[name] raise ArgumentError, "Invalid route name, already in use: '#{name}' \n" \ "You may have defined two routes with the same name using the `:as` option, or " \ "you may be overriding a route already defined by a resource with the same naming. " \ "For the latter, you can restrict the routes created with `resources` as explained here: \n" \ "https://guides.rubyonrails.org/routing.html#restricting-the-routes-created" end route = @set.add_route(name, mapping) named_routes[name] = route if name if route.segment_keys.include?(:controller) ActiveSupport::Deprecation.warn(<<-MSG.squish) Using a dynamic :controller segment in a route is deprecated and will be removed in Rails 7.1. MSG end if route.segment_keys.include?(:action) ActiveSupport::Deprecation.warn(<<-MSG.squish) Using a dynamic :action segment in a route is deprecated and will be removed in Rails 7.1. MSG end route end
def add_url_helper(name, options, &block)
def add_url_helper(name, options, &block) named_routes.add_url_helper(name, options, &block) end
def api_only?
def api_only? @config.api_only end
def append(&block)
def append(&block) @append << block end
def call(env)
Experimental RBS support (using type sampling data from the type_fusion
project).
def call: (rack.version | Integer | rack.errors | IO | rack.multithread | TrueClass | rack.multiprocess | FalseClass | rack.run_once | FalseClass | rack.url_scheme | String | SCRIPT_NAME | String | QUERY_STRING | String | SERVER_SOFTWARE | String | GATEWAY_INTERFACE | String | REQUEST_METHOD | String | REQUEST_PATH | String | REQUEST_URI | String | SERVER_PROTOCOL | String | HTTP_HOST | String | HTTP_SEC_FETCH_SITE | String | HTTP_ACCEPT_ENCODING | String | HTTP_IF_NONE_MATCH | String | HTTP_SEC_FETCH_MODE | String | HTTP_ACCEPT_LANGUAGE | String | HTTP_ACCEPT | String | HTTP_USER_AGENT | String | HTTP_CONNECTION | String | HTTP_REFERER | String | HTTP_COOKIE | String | HTTP_SEC_FETCH_DEST | String | puma.request_body_wait | Float | SERVER_NAME | String | SERVER_PORT | String | PATH_INFO | String | REMOTE_ADDR | String | HTTP_VERSION | String | puma.socket | TCPSocket | rack.hijack? | TrueClass | rack.hijack | Puma::Client | rack.input | Puma::NullIO | rack.after_reply | | puma.config | Puma::Configuration | action_dispatch.parameter_filter | Symbol | Symbol | Symbol | Symbol | Symbol | Symbol | Symbol | Symbol | action_dispatch.redirect_filter | | action_dispatch.secret_key_base | String | action_dispatch.show_exceptions | TrueClass | action_dispatch.show_detailed_exceptions | TrueClass | action_dispatch.log_rescued_responses | TrueClass | action_dispatch.logger | ActiveSupport::Logger | action_dispatch.backtrace_cleaner | Rails::BacktraceCleaner | action_dispatch.key_generator | ActiveSupport::CachingKeyGenerator | action_dispatch.http_auth_salt | String | action_dispatch.signed_cookie_salt | String | action_dispatch.encrypted_cookie_salt | String | action_dispatch.encrypted_signed_cookie_salt | String | action_dispatch.authenticated_encrypted_cookie_salt | String | action_dispatch.use_authenticated_cookie_encryption | TrueClass | action_dispatch.encrypted_cookie_cipher | NilClass | action_dispatch.signed_cookie_digest | NilClass | action_dispatch.cookies_serializer | Symbol | action_dispatch.cookies_digest | NilClass | action_dispatch.cookies_rotations | ActiveSupport::Messages::RotationConfiguration | action_dispatch.cookies_same_site_protection | Proc | action_dispatch.use_cookies_with_metadata | TrueClass | action_dispatch.content_security_policy | NilClass | action_dispatch.content_security_policy_report_only | FalseClass | action_dispatch.content_security_policy_nonce_generator | NilClass | action_dispatch.content_security_policy_nonce_directives | NilClass | action_dispatch.permissions_policy | NilClass | action_dispatch.routes | ActionDispatch::Routing::RouteSet | ROUTES_14080_SCRIPT_NAME | String | ORIGINAL_FULLPATH | String | ORIGINAL_SCRIPT_NAME | String | action_dispatch.authorized_host | String | action_dispatch.request_id | String | action_dispatch.remote_ip | ActionDispatch::RemoteIp::GetIp | rack.session | ActionDispatch::Request::Session | rack.session.options | ActionDispatch::Request::Session::Options | rack.tempfiles | | action_dispatch.request.path_parameters | controller | String | action | String | gem | String | version | String | action_controller.instance | Gems::SearchController | action_dispatch.request.content_type | NilClass | action_dispatch.request.request_parameters | | rack.request.query_string | String | rack.request.query_hash | q | String | action_dispatch.request.query_parameters | q | String | action_dispatch.request.parameters | q | String | controller | String | action | String | gem | String | version | String | action_dispatch.request.accepts | Mime::Type | action_dispatch.request.formats | Mime::Type env) -> Hash | X-Frame-Options | String | X-XSS-Protection | String | X-Content-Type-Options | String | X-Download-Options | String | X-Permitted-Cross-Domain-Policies | String | Referrer-Policy | String | Content-Type | String | Vary | String | ActionDispatch::Response::RackBody
This signature was generated using 1 sample from 1 application.
def call(env) req = make_request(env) req.path_info = Journey::Router::Utils.normalize_path(req.path_info) @router.serve(req) end
def clear!
def clear! @finalized = false named_routes.clear set.clear formatter.clear @polymorphic_mappings.clear @prepend.each { |blk| eval_block(blk) } end
def define_mounted_helper(name, script_namer = nil)
def define_mounted_helper(name, script_namer = nil) return if MountedHelpers.method_defined?(name) routes = self helpers = routes.url_helpers MountedHelpers.class_eval do define_method "_#{name}" do RoutesProxy.new(routes, _routes_context, helpers, script_namer) end end MountedHelpers.class_eval(<<-RUBY, __FILE__, __LINE__ + 1) def #{name} @_#{name} ||= _#{name} end RUBY end
def draw(&block)
def draw(&block) clear! unless @disable_clear_and_finalize eval_block(block) finalize! unless @disable_clear_and_finalize nil end
def eager_load!
def eager_load! router.eager_load! routes.each(&:eager_load!) nil end
def empty?
def empty? routes.empty? end
def eval_block(block)
def eval_block(block) mapper = Mapper.new(self) if default_scope mapper.with_default_scope(default_scope, &block) else mapper.instance_exec(&block) end end
def extra_keys(options, recall = {})
Generate the path indicated by the arguments, and return an array of
def extra_keys(options, recall = {}) generate_extras(options, recall).last end
def finalize!
def finalize! return if @finalized @append.each { |blk| eval_block(blk) } @finalized = true end
def find_relative_url_root(options)
Experimental RBS support (using type sampling data from the type_fusion
project).
type ActionDispatch__Routing__RouteSet_find_relative_url_root_options = controller | String | action | String | gem | String | version | String | class | String | controller | String | action | String | gem | String | version | String | class | String | name | String | controller | String | action | String | gem | String | version | String | class_id | String | id | String | controller | String | action | String | gem | String | version | String | file | String | controller | String | action | String | gem | String | version | String | id | ModuleDefinition | controller | String | action | String | gem | String | version | String | id | String def find_relative_url_root: (ActionDispatch__Routing__RouteSet_find_relative_url_root_options options) -> nil
This signature was generated using 21 samples from 1 application.
def find_relative_url_root(options) options.delete(:relative_url_root) || relative_url_root end
def find_script_name(options)
Experimental RBS support (using type sampling data from the type_fusion
project).
type ActionDispatch__Routing__RouteSet_find_script_name_options = host | String | port | Integer | protocol | String | controller | String | action | String | gem | String | version | String | controller | String | action | String | gem | String | version | String | class | String | host | String | port | Integer | protocol | String | controller | String | action | String | gem | String | version | Gem::Version | host | String | port | Integer | protocol | String | controller | String | action | String | gem | String | version | String | id | String | controller | String | action | String | gem | String | version | String | class_id | String | id | String | controller | String | action | String | gem | String | version | String | class | String | name | String | host | String | port | Integer | protocol | String | controller | String | action | String | gem | String | version | String | download | Integer | host | String | port | NilClass | protocol | String | _recall | controller | String | action | String | controller | String | action | String | path | String | host | String | port | Integer | protocol | String | id | String | controller | String | action | String | gem | String | version | String | host | String | port | Integer | protocol | String | _recall | controller | String | action | String | gem | String | version | String | controller | String | action | String | path | String | host | String | port | Integer | protocol | String | controller | String | action | String | gem | String | version | String | guide | String | host | String | port | Integer | protocol | String | _recall | controller | String | action | String | gem | String | version | String | id | String | controller | String | action | String | path | String | controller | String | action | String | gem | String | version | String | id | String def find_script_name: (ActionDispatch__Routing__RouteSet_find_script_name_options options) -> String
This signature was generated using 52 samples from 2 applications.
def find_script_name(options) options.delete(:script_name) || find_relative_url_root(options) || "" end
def full_url_for(options)
def full_url_for(options) @_proxy.full_url_for(options) end
def generate(route_name, options, recall = {}, method_name = nil)
Experimental RBS support (using type sampling data from the type_fusion
project).
type ActionDispatch__Routing__RouteSet_generate_options = controller | String | action | String | gem | String | version | String | class | String | controller | String | action | String | gem | String | version | String | controller | String | action | String | gem | String | version | String | class | String | name | String | controller | String | action | String | gem | String | version | Gem::Version | controller | String | action | String | gem | String | version | String | file | String | controller | String | action | String | gem | String | version | String | guide | String | controller | String | action | String | gem | String | version | String | module | ModuleDefinition | controller | String | action | String | gem | String | version | String | download | Integer | controller | String | action | String | gem | String | format | String | controller | String | action | String | gem | String | version | String | class_id | String | id | String | id | String | controller | String | action | String | gem | String | version | String | controller | String | action | String | gem | String | version | String | id | String | controller | String | action | String | gem | String | version | String | module_id | String | id | String type ActionDispatch__Routing__RouteSet_generate_recall = | controller | String | action | String | gem | String | version | String | controller | String | action | String | controller | String | action | String | gem | String | version | String | module | String | controller | String | action | String | gem | String | version | String | guide | String | format | String | controller | String | action | String | gem | String | version | String | class_id | String | id | String | id | String | controller | String | action | String | gem | String | version | String | controller | String | action | String | gem | String | version | String | id | String def generate: (String route_name, ActionDispatch__Routing__RouteSet_generate_options options, ?ActionDispatch__Routing__RouteSet_generate_recall recall, ?nil method_name) -> ActionDispatch::Journey::Formatter::RouteWithParams
This signature was generated using 56 samples from 1 application.
def generate(route_name, options, recall = {}, method_name = nil) Generator.new(route_name, options, recall, self).generate end
def generate_extras(options, recall = {})
def generate_extras(options, recall = {}) if recall options = options.merge(_recall: recall) end route_name = options.delete :use_route generator = generate(route_name, options, recall) path_info = path_for(options, route_name, []) [URI(path_info).path, generator.params.except(:_recall).keys] end
def generate_url_helpers(supports_path)
def generate_url_helpers(supports_path) routes = self Module.new do extend ActiveSupport::Concern include UrlFor # Define url_for in the singleton level so one can do: # Rails.application.routes.url_helpers.url_for(args) proxy_class = Class.new do include UrlFor include routes.named_routes.path_helpers_module include routes.named_routes.url_helpers_module attr_reader :_routes def initialize(routes) @_routes = routes end def optimize_routes_generation? @_routes.optimize_routes_generation? end end @_proxy = proxy_class.new(routes) class << self def url_for(options) @_proxy.url_for(options) end def full_url_for(options) @_proxy.full_url_for(options) end def route_for(name, *args) @_proxy.route_for(name, *args) end def optimize_routes_generation? @_proxy.optimize_routes_generation? end def polymorphic_url(record_or_hash_or_array, options = {}) @_proxy.polymorphic_url(record_or_hash_or_array, options) end def polymorphic_path(record_or_hash_or_array, options = {}) @_proxy.polymorphic_path(record_or_hash_or_array, options) end def _routes; @_proxy._routes; end def url_options; {}; end end url_helpers = routes.named_routes.url_helpers_module # Make named_routes available in the module singleton # as well, so one can do: # Rails.application.routes.url_helpers.posts_path extend url_helpers # Any class that includes this module will get all # named routes... include url_helpers if supports_path path_helpers = routes.named_routes.path_helpers_module include path_helpers extend path_helpers end # plus a singleton class method called _routes ... included do redefine_singleton_method(:_routes) { routes } end # And an instance method _routes. Note that # UrlFor (included in this module) add extra # conveniences for working with @_routes. define_method(:_routes) { @_routes || routes } define_method(:_generate_paths_by_default) do supports_path end private :_generate_paths_by_default end end
def initialize(config = DEFAULT_CONFIG)
def initialize(config = DEFAULT_CONFIG) self.named_routes = NamedRouteCollection.new self.resources_path_names = self.class.default_resources_path_names self.default_url_options = {} self.draw_paths = [] @config = config @append = [] @prepend = [] @disable_clear_and_finalize = false @finalized = false @env_key = "ROUTES_#{object_id}_SCRIPT_NAME" @set = Journey::Routes.new @router = Journey::Router.new @set @formatter = Journey::Formatter.new self @polymorphic_mappings = {} end
def initialize(routes)
def initialize(routes) @_routes = routes end
def make_request(env)
Experimental RBS support (using type sampling data from the type_fusion
project).
def make_request: ((rack.version | Integer | rack.errors | IO | rack.multithread | TrueClass | rack.multiprocess | FalseClass | rack.run_once | FalseClass | rack.url_scheme | String | SCRIPT_NAME | String | QUERY_STRING | String | SERVER_SOFTWARE | String | GATEWAY_INTERFACE | String | REQUEST_METHOD | String | REQUEST_PATH | String | REQUEST_URI | String | SERVER_PROTOCOL | String | HTTP_HOST | String | HTTP_SEC_FETCH_SITE | String | HTTP_ACCEPT_ENCODING | String | HTTP_COOKIE | String | HTTP_CONNECTION | String | HTTP_SEC_FETCH_MODE | String | HTTP_ACCEPT | String | HTTP_USER_AGENT | String | HTTP_REFERER | String | HTTP_SEC_FETCH_DEST | String | HTTP_ACCEPT_LANGUAGE | String | puma.request_body_wait | Float | SERVER_NAME | String | SERVER_PORT | String | PATH_INFO | String | REMOTE_ADDR | String | HTTP_VERSION | String | puma.socket | TCPSocket | rack.hijack? | TrueClass | rack.hijack | Puma::Client | rack.input | Puma::NullIO | rack.after_reply | | puma.config | Puma::Configuration | action_dispatch.parameter_filter | Symbol | Symbol | Symbol | Symbol | Symbol | Symbol | Symbol | Symbol | action_dispatch.redirect_filter | | action_dispatch.secret_key_base | String | action_dispatch.show_exceptions | TrueClass | action_dispatch.show_detailed_exceptions | TrueClass | action_dispatch.log_rescued_responses | TrueClass | action_dispatch.logger | ActiveSupport::Logger | action_dispatch.backtrace_cleaner | Rails::BacktraceCleaner | action_dispatch.key_generator | ActiveSupport::CachingKeyGenerator | action_dispatch.http_auth_salt | String | action_dispatch.signed_cookie_salt | String | action_dispatch.encrypted_cookie_salt | String | action_dispatch.encrypted_signed_cookie_salt | String | action_dispatch.authenticated_encrypted_cookie_salt | String | action_dispatch.use_authenticated_cookie_encryption | TrueClass | action_dispatch.encrypted_cookie_cipher | NilClass | action_dispatch.signed_cookie_digest | NilClass | action_dispatch.cookies_serializer | Symbol | action_dispatch.cookies_digest | NilClass | action_dispatch.cookies_rotations | ActiveSupport::Messages::RotationConfiguration | action_dispatch.cookies_same_site_protection | Proc | action_dispatch.use_cookies_with_metadata | TrueClass | action_dispatch.content_security_policy | NilClass | action_dispatch.content_security_policy_report_only | FalseClass | action_dispatch.content_security_policy_nonce_generator | NilClass | action_dispatch.content_security_policy_nonce_directives | NilClass | action_dispatch.permissions_policy | NilClass | action_dispatch.routes | ActionDispatch::Routing::RouteSet | ROUTES_14080_SCRIPT_NAME | String | ORIGINAL_FULLPATH | String | ORIGINAL_SCRIPT_NAME | String | action_dispatch.authorized_host | String | action_dispatch.request_id | String | action_dispatch.remote_ip | ActionDispatch::RemoteIp::GetIp | rack.session | ActionDispatch::Request::Session | rack.session.options | ActionDispatch::Request::Session::Options | rack.tempfiles | | rack.version | Integer | rack.errors | IO | rack.multithread | TrueClass | rack.multiprocess | FalseClass | rack.run_once | FalseClass | rack.url_scheme | String | SCRIPT_NAME | String | QUERY_STRING | String | SERVER_SOFTWARE | String | GATEWAY_INTERFACE | String | REQUEST_METHOD | String | REQUEST_PATH | String | REQUEST_URI | String | SERVER_PROTOCOL | String | HTTP_HOST | String | HTTP_SEC_FETCH_SITE | String | HTTP_COOKIE | String | HTTP_CONNECTION | String | HTTP_UPGRADE_INSECURE_REQUESTS | String | HTTP_SEC_FETCH_MODE | String | HTTP_ACCEPT | String | HTTP_USER_AGENT | String | HTTP_ACCEPT_LANGUAGE | String | HTTP_SEC_FETCH_DEST | String | HTTP_ACCEPT_ENCODING | String | puma.request_body_wait | Float | SERVER_NAME | String | SERVER_PORT | String | PATH_INFO | String | REMOTE_ADDR | String | HTTP_VERSION | String | puma.socket | TCPSocket | rack.hijack? | TrueClass | rack.hijack | Puma::Client | rack.input | Puma::NullIO | rack.after_reply | | puma.config | Puma::Configuration | action_dispatch.parameter_filter | Symbol | Symbol | Symbol | Symbol | Symbol | Symbol | Symbol | Symbol | action_dispatch.redirect_filter | | action_dispatch.secret_key_base | String | action_dispatch.show_exceptions | TrueClass | action_dispatch.show_detailed_exceptions | TrueClass | action_dispatch.log_rescued_responses | TrueClass | action_dispatch.logger | ActiveSupport::Logger | action_dispatch.backtrace_cleaner | Rails::BacktraceCleaner | action_dispatch.key_generator | ActiveSupport::CachingKeyGenerator | action_dispatch.http_auth_salt | String | action_dispatch.signed_cookie_salt | String | action_dispatch.encrypted_cookie_salt | String | action_dispatch.encrypted_signed_cookie_salt | String | action_dispatch.authenticated_encrypted_cookie_salt | String | action_dispatch.use_authenticated_cookie_encryption | TrueClass | action_dispatch.encrypted_cookie_cipher | NilClass | action_dispatch.signed_cookie_digest | NilClass | action_dispatch.cookies_serializer | Symbol | action_dispatch.cookies_digest | NilClass | action_dispatch.cookies_rotations | ActiveSupport::Messages::RotationConfiguration | action_dispatch.cookies_same_site_protection | Proc | action_dispatch.use_cookies_with_metadata | TrueClass | action_dispatch.content_security_policy | NilClass | action_dispatch.content_security_policy_report_only | FalseClass | action_dispatch.content_security_policy_nonce_generator | NilClass | action_dispatch.content_security_policy_nonce_directives | NilClass | action_dispatch.permissions_policy | NilClass | action_dispatch.routes | ActionDispatch::Routing::RouteSet | ROUTES_14080_SCRIPT_NAME | String | ORIGINAL_FULLPATH | String | ORIGINAL_SCRIPT_NAME | String | action_dispatch.authorized_host | String | action_dispatch.request_id | String | action_dispatch.remote_ip | ActionDispatch::RemoteIp::GetIp | rack.session | ActionDispatch::Request::Session | rack.session.options | ActionDispatch::Request::Session::Options | rack.tempfiles | ) env) -> ActionDispatch::Request
This signature was generated using 2 samples from 1 application.
def make_request(env) request_class.new env end
def mounted_helpers
Experimental RBS support (using type sampling data from the type_fusion
project).
def mounted_helpers: () -> Module
This signature was generated using 1 sample from 1 application.
You can include this in your classes if you want to
engines and the `main_app` helper for the application.
Contains all the mounted helpers across different
def mounted_helpers MountedHelpers end
def optimize_routes_generation?
Experimental RBS support (using type sampling data from the type_fusion
project).
def optimize_routes_generation?: () -> true
This signature was generated using 5 samples from 1 application.
def optimize_routes_generation? @_routes.optimize_routes_generation? end
def optimize_routes_generation?
Experimental RBS support (using type sampling data from the type_fusion
project).
def optimize_routes_generation?: () -> true
This signature was generated using 5 samples from 1 application.
def optimize_routes_generation? @_proxy.optimize_routes_generation? end
def optimize_routes_generation?
Experimental RBS support (using type sampling data from the type_fusion
project).
def optimize_routes_generation?: () -> true
This signature was generated using 5 samples from 1 application.
def optimize_routes_generation? default_url_options.empty? end
def path_for(options, route_name = nil, reserved = RESERVED_OPTIONS)
def path_for(options, route_name = nil, reserved = RESERVED_OPTIONS) url_for(options, route_name, PATH, nil, reserved) end
def polymorphic_path(record_or_hash_or_array, options = {})
def polymorphic_path(record_or_hash_or_array, options = {}) @_proxy.polymorphic_path(record_or_hash_or_array, options) end
def polymorphic_url(record_or_hash_or_array, options = {})
def polymorphic_url(record_or_hash_or_array, options = {}) @_proxy.polymorphic_url(record_or_hash_or_array, options) end
def prepend(&block)
def prepend(&block) @prepend << block end
def recognize_path(path, environment = {})
def recognize_path(path, environment = {}) method = (environment[:method] || "GET").to_s.upcase path = Journey::Router::Utils.normalize_path(path) unless %r{://}.match?(path) extras = environment[:extras] || {} begin env = Rack::MockRequest.env_for(path, method: method) rescue URI::InvalidURIError => e raise ActionController::RoutingError, e.message end req = make_request(env) recognize_path_with_request(req, path, extras) end
def recognize_path_with_request(req, path, extras, raise_on_missing: true)
def recognize_path_with_request(req, path, extras, raise_on_missing: true) @router.recognize(req) do |route, params| params.merge!(extras) params.each do |key, value| if value.is_a?(String) value = value.dup.force_encoding(Encoding::BINARY) params[key] = URI::DEFAULT_PARSER.unescape(value) end end req.path_parameters = params app = route.app if app.matches?(req) && app.dispatcher? begin req.controller_class rescue NameError raise ActionController::RoutingError, "A route matches #{path.inspect}, but references missing controller: #{params[:controller].camelize}Controller" end return req.path_parameters elsif app.matches?(req) && app.engine? path_parameters = app.rack_app.routes.recognize_path_with_request(req, path, extras, raise_on_missing: false) return path_parameters if path_parameters end end if raise_on_missing raise ActionController::RoutingError, "No route matches #{path.inspect}" end end
def relative_url_root
Experimental RBS support (using type sampling data from the type_fusion
project).
def relative_url_root: () -> nil
This signature was generated using 22 samples from 1 application.
def relative_url_root @config.relative_url_root end
def request_class
Experimental RBS support (using type sampling data from the type_fusion
project).
def request_class: () -> Class
This signature was generated using 1 sample from 1 application.
def request_class ActionDispatch::Request end
def route_for(name, *args)
def route_for(name, *args) @_proxy.route_for(name, *args) end
def url_for(options)
Experimental RBS support (using type sampling data from the type_fusion
project).
type ActionDispatch__Routing__RouteSet_url_for_options = controller | String | action | String | gem | String | version | String | class | String | path | String | script_name | String | params | | user | NilClass | password | NilClass | controller | String | action | String | gem | String | version | String | module | ModuleDefinition | path | String | script_name | String | params | | user | NilClass | password | NilClass | host | String | port | Integer | protocol | String | controller | String | action | String | gem | String | version | Gem::Version | path | String | script_name | String | params | | user | NilClass | password | NilClass | controller | String | action | String | gem | String | version | String | path | String | script_name | String | params | | user | NilClass | password | NilClass | host | String | port | Integer | protocol | String | controller | String | action | String | gem | String | version | String | path | String | script_name | String | params | | user | NilClass | password | NilClass | controller | String | action | String | gem | String | version | String | file | String | path | String | script_name | String | params | | user | NilClass | password | NilClass | host | String | port | Integer | protocol | String | controller | String | action | String | gem | String | version | String | download | Integer | require_samples | Integer | path | String | script_name | String | params | download | Integer | require_samples | Integer | user | NilClass | password | NilClass | host | String | port | Integer | protocol | String | id | String | controller | String | action | String | gem | String | version | String | path | String | script_name | String | params | | user | NilClass | password | NilClass | controller | String | action | String | gem | String | version | String | id | String | path | String | script_name | String | params | | user | NilClass | password | NilClass | controller | String | action | String | gem | String | version | String | class_id | String | id | String | path | String | script_name | String | params | | user | NilClass | password | NilClass | host | String | port | Integer | protocol | String | controller | String | action | String | gem | String | version | String | id | String | path | String | script_name | String | params | | user | NilClass | password | NilClass def url_for: (ActionDispatch__Routing__RouteSet_url_for_options options, ?String route_name, ?Proc url_strategy, ?Symbol method_name, ?Symbol | Symbol | Symbol | Symbol | Symbol | Symbol | Symbol | Symbol | Symbol | Symbol | Symbol | Symbol reserved) -> String
This signature was generated using 39 samples from 1 application.
def url_for(options) @_proxy.url_for(options) end
def url_for(options, route_name = nil, url_strategy = UNKNOWN, method_name = nil, reserved = RESERVED_OPTIONS)
Experimental RBS support (using type sampling data from the type_fusion
project).
type ActionDispatch__Routing__RouteSet_url_for_options = controller | String | action | String | gem | String | version | String | class | String | path | String | script_name | String | params | | user | NilClass | password | NilClass | controller | String | action | String | gem | String | version | String | module | ModuleDefinition | path | String | script_name | String | params | | user | NilClass | password | NilClass | host | String | port | Integer | protocol | String | controller | String | action | String | gem | String | version | Gem::Version | path | String | script_name | String | params | | user | NilClass | password | NilClass | controller | String | action | String | gem | String | version | String | path | String | script_name | String | params | | user | NilClass | password | NilClass | host | String | port | Integer | protocol | String | controller | String | action | String | gem | String | version | String | path | String | script_name | String | params | | user | NilClass | password | NilClass | controller | String | action | String | gem | String | version | String | file | String | path | String | script_name | String | params | | user | NilClass | password | NilClass | host | String | port | Integer | protocol | String | controller | String | action | String | gem | String | version | String | download | Integer | require_samples | Integer | path | String | script_name | String | params | download | Integer | require_samples | Integer | user | NilClass | password | NilClass | host | String | port | Integer | protocol | String | id | String | controller | String | action | String | gem | String | version | String | path | String | script_name | String | params | | user | NilClass | password | NilClass | controller | String | action | String | gem | String | version | String | id | String | path | String | script_name | String | params | | user | NilClass | password | NilClass | controller | String | action | String | gem | String | version | String | class_id | String | id | String | path | String | script_name | String | params | | user | NilClass | password | NilClass | host | String | port | Integer | protocol | String | controller | String | action | String | gem | String | version | String | id | String | path | String | script_name | String | params | | user | NilClass | password | NilClass def url_for: (ActionDispatch__Routing__RouteSet_url_for_options options, ?String route_name, ?Proc url_strategy, ?Symbol method_name, ?Symbol | Symbol | Symbol | Symbol | Symbol | Symbol | Symbol | Symbol | Symbol | Symbol | Symbol | Symbol reserved) -> String
This signature was generated using 39 samples from 1 application.
def url_for(options, route_name = nil, url_strategy = UNKNOWN, method_name = nil, reserved = RESERVED_OPTIONS) options = default_url_options.merge options user = password = nil if options[:user] && options[:password] user = options.delete :user password = options.delete :password end recall = options.delete(:_recall) { {} } original_script_name = options.delete(:original_script_name) script_name = find_script_name options if original_script_name script_name = original_script_name + script_name end path_options = options.dup reserved.each { |ro| path_options.delete ro } route_with_params = generate(route_name, path_options, recall) path = route_with_params.path(method_name) if options[:trailing_slash] && !options[:format] && !path.end_with?("/") path += "/" end params = route_with_params.params if options.key? :params if options[:params]&.respond_to?(:to_hash) params.merge! options[:params] else params[:params] = options[:params] end end options[:path] = path options[:script_name] = script_name options[:params] = params options[:user] = user options[:password] = password url_strategy.call options end
def url_helpers(supports_path = true)
Experimental RBS support (using type sampling data from the type_fusion
project).
def url_helpers: (?true supports_path) -> Module
This signature was generated using 3 samples from 1 application.
def url_helpers(supports_path = true) if supports_path @url_helpers_with_paths ||= generate_url_helpers(true) else @url_helpers_without_paths ||= generate_url_helpers(false) end end
def url_options; {}; end
def url_options; {}; end