diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2015-08-14 10:44:49 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2015-08-14 10:44:49 -0700 |
commit | b592c5b607e4879c0b603bf636cf6d11e9f4b8d2 (patch) | |
tree | 8bdc00f903c4648b9ec3a40c64419b1dc9c7a7f6 /actionpack | |
parent | aaaa67902ee1d129a6907e4ebd726f383ad7002b (diff) | |
download | rails-b592c5b607e4879c0b603bf636cf6d11e9f4b8d2.tar.gz rails-b592c5b607e4879c0b603bf636cf6d11e9f4b8d2.tar.bz2 rails-b592c5b607e4879c0b603bf636cf6d11e9f4b8d2.zip |
pass the path ast down
now we don't need to add it to a hash and delete it from the hash later
just to pass it around
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 3 | ||||
-rw-r--r-- | actionpack/lib/action_dispatch/routing/route_set.rb | 5 | ||||
-rw-r--r-- | actionpack/test/dispatch/mapper_test.rb | 2 |
3 files changed, 4 insertions, 6 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 98c17c6dbb..40b10d33e9 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -134,7 +134,6 @@ module ActionDispatch @defaults = formats[:defaults].merge(@defaults).merge(normalize_defaults(options)) @conditions[:required_defaults] = (split_options[:required_defaults] || []).map(&:first) - @conditions[:parsed_path_info] = ast unless via == [:all] @conditions[:request_method] = via.map { |m| m.to_s.dasherize.upcase } end @@ -1605,7 +1604,7 @@ module ActionDispatch mapping = Mapping.build(@scope, @set, ast, controller, default_action, to, via, formatted, options_constraints, options) app, conditions, requirements, defaults = mapping.to_route - @set.add_route(app, conditions, requirements, defaults, as, anchor) + @set.add_route(app, conditions, ast, requirements, defaults, as, anchor) end def root(path, options={}) diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb index a3cadec68f..04d8013768 100644 --- a/actionpack/lib/action_dispatch/routing/route_set.rb +++ b/actionpack/lib/action_dispatch/routing/route_set.rb @@ -514,7 +514,7 @@ module ActionDispatch routes.empty? end - def add_route(app, conditions, requirements, defaults, name, anchor) + def add_route(app, conditions, path_ast, requirements, defaults, name, anchor) raise ArgumentError, "Invalid route name: '#{name}'" unless name.blank? || name.to_s.match(/^[_a-z]\w*$/i) if name && named_routes[name] @@ -525,9 +525,8 @@ module ActionDispatch "http://guides.rubyonrails.org/routing.html#restricting-the-routes-created" end - ast = conditions.delete :parsed_path_info required_defaults = conditions.delete :required_defaults - path = build_path(ast, requirements, anchor) + path = build_path(path_ast, requirements, anchor) conditions = build_conditions(conditions) route = @set.add_route(app, path, conditions, required_defaults, defaults, name) diff --git a/actionpack/test/dispatch/mapper_test.rb b/actionpack/test/dispatch/mapper_test.rb index 0c506a13bf..289fb69b8b 100644 --- a/actionpack/test/dispatch/mapper_test.rb +++ b/actionpack/test/dispatch/mapper_test.rb @@ -27,7 +27,7 @@ module ActionDispatch end def defaults - @my_routes.map { |x| x[3] } + @my_routes.map { |x| x[4] } end def conditions |