aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/journey
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_dispatch/journey')
-rw-r--r--actionpack/lib/action_dispatch/journey/routes.rb14
1 files changed, 12 insertions, 2 deletions
diff --git a/actionpack/lib/action_dispatch/journey/routes.rb b/actionpack/lib/action_dispatch/journey/routes.rb
index 5990964b57..eba43c3c36 100644
--- a/actionpack/lib/action_dispatch/journey/routes.rb
+++ b/actionpack/lib/action_dispatch/journey/routes.rb
@@ -62,9 +62,19 @@ module ActionDispatch
end
end
- # Add a route to the routing table.
+ MyMapping = Struct.new(:application, :path, :conditions, :required_defaults, :defaults)
+
def add_route(app, path, conditions, required_defaults, defaults, name = nil)
- route = Route.new(name, app, path, conditions, required_defaults, defaults)
+ add_route2(name, MyMapping.new(app, path, conditions, required_defaults, defaults))
+ end
+
+ def add_route2(name, mapping)
+ route = Route.new(name,
+ mapping.application,
+ mapping.path,
+ mapping.conditions,
+ mapping.required_defaults,
+ mapping.defaults)
route.precedence = routes.length
routes << route