diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2014-05-21 11:55:15 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2014-05-21 14:27:30 -0700 |
commit | 7bc25f003502633eadc26b5cbafebb66f578c058 (patch) | |
tree | 97e9965e5ade9f41a4a36a4914be7569b631ef63 /actionpack/lib/action_dispatch | |
parent | 620cb0167667e2f5d788c11b637db51d20496dcc (diff) | |
download | rails-7bc25f003502633eadc26b5cbafebb66f578c058.tar.gz rails-7bc25f003502633eadc26b5cbafebb66f578c058.tar.bz2 rails-7bc25f003502633eadc26b5cbafebb66f578c058.zip |
do not mutate parameters, let the caller do mutations
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r-- | actionpack/lib/action_dispatch/journey/formatter.rb | 6 | ||||
-rw-r--r-- | actionpack/lib/action_dispatch/journey/route.rb | 4 |
2 files changed, 6 insertions, 4 deletions
diff --git a/actionpack/lib/action_dispatch/journey/formatter.rb b/actionpack/lib/action_dispatch/journey/formatter.rb index aa8d5a4d79..7eaf8e49ce 100644 --- a/actionpack/lib/action_dispatch/journey/formatter.rb +++ b/actionpack/lib/action_dispatch/journey/formatter.rb @@ -30,6 +30,12 @@ module ActionDispatch parameterized_parts.key?(key) || route.defaults.key?(key) end + defaults = route.defaults + required_parts = route.required_parts + parameterized_parts.delete_if do |key, value| + value.to_s == defaults[key].to_s && !required_parts.include?(key) + end + return [route.format(parameterized_parts), params] end diff --git a/actionpack/lib/action_dispatch/journey/route.rb b/actionpack/lib/action_dispatch/journey/route.rb index 982ff3e259..1effcd5a5e 100644 --- a/actionpack/lib/action_dispatch/journey/route.rb +++ b/actionpack/lib/action_dispatch/journey/route.rb @@ -73,10 +73,6 @@ module ActionDispatch alias :segment_keys :parts def format(path_options) - path_options.delete_if do |key, value| - value.to_s == defaults[key].to_s && !required_parts.include?(key) - end - @formatter.evaluate path_options end |