Skip to content

Commit

Permalink
Cleanup generate_extras build/parse mess
Browse files Browse the repository at this point in the history
  • Loading branch information
josh committed Dec 11, 2009
1 parent 1b82590 commit d119150
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions actionpack/lib/action_dispatch/routing/route_set.rb
Expand Up @@ -433,7 +433,7 @@ def generate(options, recall = {}, method = :generate)
raise ActionController::RoutingError, "No route matches #{options.inspect}"
end

uri, params = result
path, params = result
params.each do |k, v|
if v
params[k] = v
Expand All @@ -442,16 +442,10 @@ def generate(options, recall = {}, method = :generate)
end
end

uri << "?#{params.to_query}" if uri && params.any?
path = uri

if path && method == :generate_extras
uri = URI(path)
extras = uri.query ?
Rack::Utils.parse_nested_query(uri.query).keys.map { |k| k.to_sym } :
[]
[uri.path, extras]
[path, params.keys]
elsif path
path << "?#{params.to_query}" if params.any?
path
else
raise ActionController::RoutingError, "No route matches #{options.inspect}"
Expand Down

0 comments on commit d119150

Please sign in to comment.