The RouteSet
contains a collection of Route instances, representing the routes typically defined in config/routes.rb
.
Namespace
- MODULE ActionDispatch::Routing::RouteSet::MountedHelpers
- CLASS ActionDispatch::Routing::RouteSet::CustomUrlHelper
- CLASS ActionDispatch::Routing::RouteSet::Dispatcher
- CLASS ActionDispatch::Routing::RouteSet::Generator
- CLASS ActionDispatch::Routing::RouteSet::NamedRouteCollection
- CLASS ActionDispatch::Routing::RouteSet::StaticDispatcher
Methods
Instance Public methods
from_requirements(requirements) Link
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”)