method

from_requirements

rails latest stable - Class: ActionDispatch::Routing::RouteSet

Method not available on this version

This method is only available on newer versions. The first available version (v7.2.3) is shown here.

from_requirements(requirements)
public

Returns a Route matching the given requirements, or `nil` if none are found.

This is intended for use by tools such as Language Servers.

Given the routes are defined as:

resources :posts

Then the following will return the Route for the `show` action:

Rails.application.routes.from_requirements(controller: "posts", action: "show")