diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2015-08-14 16:13:26 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2015-08-14 16:13:26 -0700 |
commit | 6c48d9392fe964640fe5721fcd27bb170613cc27 (patch) | |
tree | b3e2a8b36ecd6f2e0a37a4a01beca13d8214ed97 /actionpack/lib/action_dispatch/journey | |
parent | 5ba6966766e67af4ae0028c4429acbd280a100a2 (diff) | |
download | rails-6c48d9392fe964640fe5721fcd27bb170613cc27.tar.gz rails-6c48d9392fe964640fe5721fcd27bb170613cc27.tar.bz2 rails-6c48d9392fe964640fe5721fcd27bb170613cc27.zip |
pass pass the mapping object down the add_route stack
then we can let the mapping object derive stuff that the Route object
needs.
Diffstat (limited to 'actionpack/lib/action_dispatch/journey')
-rw-r--r-- | actionpack/lib/action_dispatch/journey/routes.rb | 14 |
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 |