aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_dispatch/journey/routes.rb9
-rw-r--r--actionpack/lib/action_dispatch/routing/mapper.rb12
2 files changed, 13 insertions, 8 deletions
diff --git a/actionpack/lib/action_dispatch/journey/routes.rb b/actionpack/lib/action_dispatch/journey/routes.rb
index 4770b8b7cc..f7b009109e 100644
--- a/actionpack/lib/action_dispatch/journey/routes.rb
+++ b/actionpack/lib/action_dispatch/journey/routes.rb
@@ -61,14 +61,7 @@ module ActionDispatch
end
def add_route(name, mapping)
- route = Route.new(name,
- mapping.application,
- mapping.path,
- mapping.conditions,
- mapping.required_defaults,
- mapping.defaults)
-
- route.precedence = routes.length
+ route = mapping.make_route name, routes.length
routes << route
partition_route(route)
clear_cache!
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb
index f82c3c0d34..a9dae77e51 100644
--- a/actionpack/lib/action_dispatch/routing/mapper.rb
+++ b/actionpack/lib/action_dispatch/routing/mapper.rb
@@ -143,6 +143,18 @@ module ActionDispatch
@required_defaults = (split_options[:required_defaults] || []).map(&:first)
end
+ def make_route(name, precedence)
+ route = Journey::Route.new(name,
+ application,
+ path,
+ conditions,
+ required_defaults,
+ defaults)
+
+ route.precedence = precedence
+ route
+ end
+
def application
app(@blocks)
end