diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-04-24 09:53:51 -0300 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-04-24 09:53:51 -0300 |
commit | 2658d9736557c5bdb78014abecdbb174e0dc8b88 (patch) | |
tree | 889a04659105d77a86f662dbb77a0ece58e15def /actionpack/lib/action_dispatch | |
parent | afcae3455121ae76b92056336740795b33c1fb0c (diff) | |
download | rails-2658d9736557c5bdb78014abecdbb174e0dc8b88.tar.gz rails-2658d9736557c5bdb78014abecdbb174e0dc8b88.tar.bz2 rails-2658d9736557c5bdb78014abecdbb174e0dc8b88.zip |
Refactor hash creation in routeset
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/route_set.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb index 60303da970..f1aa131cbb 100644 --- a/actionpack/lib/action_dispatch/routing/route_set.rb +++ b/actionpack/lib/action_dispatch/routing/route_set.rb @@ -98,6 +98,7 @@ module ActionDispatch @helpers = [] @module = Module.new do protected + def handle_positional_args(args, options, route) inner_options = args.extract_options! result = options.dup @@ -105,10 +106,10 @@ module ActionDispatch if args.any? keys = route.segment_keys if args.size < keys.size - 1 # take format into account - keys -= self.url_options.keys if self.respond_to?(:url_options) + keys -= self.url_options.keys if self.respond_to?(:url_options) keys -= options.keys end - result.merge!(Hash[args.zip(keys).map { |v, k| [k, v] }]) + result.merge!(Hash[keys.zip(args)]) end result.merge!(inner_options) @@ -161,7 +162,7 @@ module ActionDispatch end def hash_access_name(name, only_path) - if only_path + if only_path :"hash_for_#{name}_path" else :"hash_for_#{name}_url" |