Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

reduce conditionals in url_for

  • Loading branch information...
commit 9df60693d77813b362fb528fc62381ac8f1eec12 1 parent 2d73a73
Aaron Patterson tenderlove authored
Showing with 6 additions and 3 deletions.
  1. +6 −3 actionpack/lib/action_dispatch/routing/route_set.rb
9 actionpack/lib/action_dispatch/routing/route_set.rb
View
@@ -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,
Please sign in to comment.
Something went wrong with that request. Please try again.