Permalink
Browse files

reduce conditionals in url_for

  • Loading branch information...
tenderlove committed May 12, 2014
1 parent 2d73a73 commit 9df60693d77813b362fb528fc62381ac8f1eec12
Showing with 6 additions and 3 deletions.
  1. +6 −3 actionpack/lib/action_dispatch/routing/route_set.rb
@@ -655,7 +655,7 @@ def url_for(options)
options = default_url_options.merge(options || {})
user, password = extract_authentication(options)
- recall = options.delete(:_recall)
+ recall = options.delete(:_recall) { {} }
original_script_name = options.delete(:original_script_name).presence
script_name = options.delete(:script_name).presence || _generate_prefix(options)
@@ -668,8 +668,11 @@ def url_for(options)
RESERVED_OPTIONS.each { |ro| path_options.delete ro }
path_options = yield(path_options) if block_given?
- path, params = generate(path_options, recall || {})
- params.merge!(options[:params] || {})
+ path, params = generate(path_options, recall)
+
+ if options.key? :params
+ params.merge! options[:params]
+ end
ActionDispatch::Http::URL.url_for(options.merge!({
:path => path,

0 comments on commit 9df6069

Please sign in to comment.