Class: ActionDispatch::Routing::Mapper
Relationships & Source Files | |
Namespace Children | |
Modules:
| |
Super Chains via Extension / Inclusion / Inheritance | |
Instance Chain:
|
|
Inherits: | Object |
Defined in: | actionpack/lib/action_dispatch/routing/mapper.rb |
Constant Summary
-
URL_OPTIONS =
# File 'actionpack/lib/action_dispatch/routing/mapper.rb', line 13[:protocol, :subdomain, :domain, :host, :port]
Resources
- Included
Class Method Summary
- .normalize_name(name)
-
.normalize_path(path)
Invokes Journey::Router::Utils.normalize_path and ensure that (:locale) becomes (/:locale) instead of /(:locale).
Instance Attribute Summary
Instance Method Summary
CustomUrls
- Included
#direct | Define custom URL helpers that will be added to the application’s routes. |
#resolve | Define custom polymorphic mappings of models to URLs. |
Resources
- Included
#collection | To add a route to the collection: |
#match | Matches a URL pattern to one or more routes. |
#member | To add a member route, add a member block into the resource block: |
#namespace | See Scoping#namespace. |
#nested, #new, | |
#resource | Sometimes, you have a resource that clients always look up without referencing an ID. |
#resources | In Rails, a resourceful route provides a mapping between HTTP verbs and URLs and controller actions. |
#resources_path_names, | |
#root | You can specify what |
#set_member_mappings_for_resource, #with_scope_level |
Concerns
- Included
Scoping
- Included
#constraints | Parameter Restriction Allows you to constrain the nested routes based on a set of rules. |
#controller | Scopes routes to a specific controller. |
#defaults | Allows you to set default parameters for a route, such as this: |
#namespace | Scopes routes to a specific namespace. |
#scope | Scopes a set of routes to the given default options. |
Redirection
- Included
HttpHelpers
- Included
#delete | Define a route that only recognizes HTTP DELETE. |
#get | Define a route that only recognizes HTTP GET. |
#patch | Define a route that only recognizes HTTP PATCH. |
#post | Define a route that only recognizes HTTP POST. |
#put | Define a route that only recognizes HTTP PUT. |
Base
- Included
#has_named_route? | Query if the following named route was already defined. |
#match | Matches a URL pattern to one or more routes. |
#mount | Mount a Rack-based application to be used within the application. |
#with_default_scope |
Class Method Details
.normalize_name(name)
[ GitHub ]# File 'actionpack/lib/action_dispatch/routing/mapper.rb', line 397
def self.normalize_name(name) normalize_path(name)[1..-1].tr("/", "_") end
.normalize_path(path)
Invokes Journey::Router::Utils.normalize_path and ensure that (:locale) becomes (/:locale) instead of /(:locale). Except for root cases, where the latter is the correct one.
# File 'actionpack/lib/action_dispatch/routing/mapper.rb', line 391
def self.normalize_path(path) path = Journey::Router::Utils.normalize_path(path) path.gsub!(%r{/(\(+)/?}, '\1/') unless path =~ %r{^/(\([^)]\)){1,}$} path end