Skip to content

Commit 348af15

Browse files
committed
_recall should be set to a hash or not set
Then we can avoid nil checks
1 parent 760aa3b commit 348af15

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

actionpack/lib/action_dispatch/routing/route_set.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ def url_for(options)
656656
password = options.delete :password
657657
end
658658

659-
recall = options.delete(:_recall)
659+
recall = options.delete(:_recall) { {} }
660660

661661
original_script_name = options.delete(:original_script_name)
662662
script_name = find_script_name options
@@ -668,7 +668,7 @@ def url_for(options)
668668
path_options = options.dup
669669
RESERVED_OPTIONS.each { |ro| path_options.delete ro }
670670

671-
path, params = generate(path_options, recall || {})
671+
path, params = generate(path_options, recall)
672672
params.merge!(options[:params] || {})
673673

674674
ActionDispatch::Http::URL.url_for(options.merge!({

actionpack/test/abstract_unit.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,8 +320,8 @@ def get(uri_or_host, path = nil)
320320
end
321321

322322
module RoutingTestHelpers
323-
def url_for(set, options, recall = nil)
324-
set.send(:url_for, options.merge(:only_path => true, :_recall => recall))
323+
def url_for(set, options, recall = {})
324+
set.url_for options.merge(:only_path => true, :_recall => recall)
325325
end
326326
end
327327

0 commit comments

Comments
 (0)