Class: ActionDispatch::Routing::Mapper
- Inherits:
-
Object
- Object
- ActionDispatch::Routing::Mapper
- Includes:
- Base, HttpHelpers, Resources, Scoping, Shorthand, Redirection
- Defined in:
- actionpack/lib/action_dispatch/routing/mapper.rb
Defined Under Namespace
Modules: Base, HttpHelpers, Resources, Scoping, Shorthand Classes: Constraints, Mapping
Constant Summary
Constant Summary
Constants included from Resources
Resources::CANONICAL_ACTIONS, Resources::RESOURCE_OPTIONS, Resources::VALID_ON_OPTIONS
Class Method Summary (collapse)
- + (Object) normalize_name(name)
-
+ (Object) normalize_path(path)
Invokes Rack::Mount::Utils.normalize path and ensure that (:locale) becomes (/:locale) instead of /(:locale).
Methods included from Shorthand
Methods included from Resources
#collection, #initialize, #match, #member, #namespace, #nested, #new, #resource, #resources, #resources_path_names, #root, #shallow, #shallow?
Methods included from Scoping
#constraints, #controller, #defaults, #initialize, #namespace, #scope
Methods included from Redirection
Methods included from HttpHelpers
Methods included from Base
#default_url_options=, #initialize, #match, #mount, #root, #with_default_scope
Class Method Details
+ (Object) normalize_name(name)
237 238 239 |
# File 'actionpack/lib/action_dispatch/routing/mapper.rb', line 237 def self.normalize_name(name) normalize_path(name)[1..-1].gsub("/", "_") end |
+ (Object) normalize_path(path)
Invokes Rack::Mount::Utils.normalize path and ensure that (:locale) becomes (/:locale) instead of /(:locale). Except for root cases, where the latter is the correct one.
231 232 233 234 235 |
# File 'actionpack/lib/action_dispatch/routing/mapper.rb', line 231 def self.normalize_path(path) path = Rack::Mount::Utils.normalize_path(path) path.gsub!(%r{/(\(+)/?}, '\1/') unless path =~ %r{^/\(+[^/]+\)$} path end |