aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorAndrew White <andrew.white@unboxed.co>2017-02-20 13:55:29 +0000
committerAndrew White <andrew.white@unboxed.co>2017-02-21 15:30:46 +0000
commit7d1e738057cead1970d8aca31310a51a59f7235f (patch)
tree2024573a36d9ffd6ba20e555ef9999598cd9fd0c /actionpack
parente96da0a7beb483ed5e8a8096ff67b09ecc5ca7a1 (diff)
downloadrails-7d1e738057cead1970d8aca31310a51a59f7235f.tar.gz
rails-7d1e738057cead1970d8aca31310a51a59f7235f.tar.bz2
rails-7d1e738057cead1970d8aca31310a51a59f7235f.zip
Don't allocate a hash unnecessarily
Diffstat (limited to 'actionpack')
-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