Permalink
Browse files

only extract :params from the options hash once

  • Loading branch information...
1 parent 1e930e7 commit f875331e3282228d2019392b1653fb8ea39fd711 @tenderlove tenderlove committed Jul 17, 2014
Showing with 2 additions and 3 deletions.
  1. +2 −3 actionpack/lib/action_dispatch/http/url.rb
@@ -48,9 +48,8 @@ def url_for(options)
end
if options.key? :params
- params = options[:params].is_a?(Hash) ?
- options[:params] :
- { params: options[:params] }
+ param = options[:params]
+ params = param.is_a?(Hash) ? param : { params: param }
params.reject! { |_,v| v.to_param.nil? }
result << "?#{params.to_query}" unless params.empty?

0 comments on commit f875331

Please sign in to comment.