aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--actionpack/lib/action_dispatch/routing/mapper.rb2
-rw-r--r--actionpack/lib/action_dispatch/routing/route_set.rb6
2 files changed, 6 insertions, 2 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb
index fceadc7039..3756ef15a2 100644
--- a/actionpack/lib/action_dispatch/routing/mapper.rb
+++ b/actionpack/lib/action_dispatch/routing/mapper.rb
@@ -2055,7 +2055,7 @@ module ActionDispatch
#
# NOTE: It is the url helper's responsibility to return the correct
# set of options to be passed to the `url_for` call.
- def direct(name, options = {}, &block)
+ def direct(name, options = nil, &block)
case name
when String, Symbol
@set.add_url_helper(name, options, &block)
diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb
index b1f7cd30fc..923d063655 100644
--- a/actionpack/lib/action_dispatch/routing/route_set.rb
+++ b/actionpack/lib/action_dispatch/routing/route_set.rb
@@ -210,7 +210,11 @@ module ActionDispatch
private
def eval_block(t, args, options)
- t.instance_exec(*args, defaults.merge(options), &block)
+ t.instance_exec(*args, merge_defaults(options), &block)
+ end
+
+ def merge_defaults(options)
+ defaults ? defaults.merge(options) : options
end
end