Permalink
Browse files

Refactor hash creation in routeset

  • Loading branch information...
carlosantoniodasilva committed Apr 24, 2012
1 parent afcae34 commit 2658d9736557c5bdb78014abecdbb174e0dc8b88
Showing with 4 additions and 3 deletions.
  1. +4 −3 actionpack/lib/action_dispatch/routing/route_set.rb
@@ -98,17 +98,18 @@ def initialize
@helpers = []
@module = Module.new do
protected
+
def handle_positional_args(args, options, route)
inner_options = args.extract_options!
result = options.dup
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 @@ def url_helper_name(name, only_path)
end
def hash_access_name(name, only_path)
- if only_path
+ if only_path
:"hash_for_#{name}_path"
else
:"hash_for_#{name}_url"

0 comments on commit 2658d97

Please sign in to comment.