diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2014-05-29 15:27:46 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2014-05-29 15:27:46 -0700 |
commit | 333a4d09ab8b024b3d23618e9d668bef2bab1355 (patch) | |
tree | 77c0f30a6cba905c3c555cc83171fd83af444907 /actionpack/lib | |
parent | 15ffbedf3bb5907c3774fcc38466c799e92f9a04 (diff) | |
download | rails-333a4d09ab8b024b3d23618e9d668bef2bab1355.tar.gz rails-333a4d09ab8b024b3d23618e9d668bef2bab1355.tar.bz2 rails-333a4d09ab8b024b3d23618e9d668bef2bab1355.zip |
pass the parsed path from mapper to the Strexp
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 5 | ||||
-rw-r--r-- | actionpack/lib/action_dispatch/routing/route_set.rb | 9 |
2 files changed, 9 insertions, 5 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 38d6d6539a..879e8daa33 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -80,7 +80,7 @@ module ActionDispatch path_params = path_params ast @options = normalize_options!(options, path_params, ast) normalize_requirements!(path_params) - normalize_conditions!(path_params, path) + normalize_conditions!(path_params, path, ast) normalize_defaults! end @@ -192,8 +192,9 @@ module ActionDispatch end end - def normalize_conditions!(path_params, path) + def normalize_conditions!(path_params, path, ast) @conditions[:path_info] = path + @conditions[:parsed_path_info] = ast constraints.each do |key, condition| unless path_params.include?(key) || key == :controller diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb index 66d1805702..bdda802195 100644 --- a/actionpack/lib/action_dispatch/routing/route_set.rb +++ b/actionpack/lib/action_dispatch/routing/route_set.rb @@ -418,7 +418,9 @@ module ActionDispatch "http://guides.rubyonrails.org/routing.html#restricting-the-routes-created" end - path = build_path(conditions.delete(:path_info), requirements, SEPARATORS, anchor) + path = conditions.delete :path_info + ast = conditions.delete :parsed_path_info + path = build_path(path, ast, requirements, SEPARATORS, anchor) conditions = build_conditions(conditions, path.names.map { |x| x.to_sym }) route = @set.add_route(app, path, conditions, defaults, name) @@ -426,8 +428,9 @@ module ActionDispatch route end - def build_path(path, requirements, separators, anchor) - strexp = Journey::Router::Strexp.build( + def build_path(path, ast, requirements, separators, anchor) + strexp = Journey::Router::Strexp.new( + ast, path, requirements, SEPARATORS, |