diff options
author | Andrew White <andrew.white@unboxed.co> | 2017-02-20 13:55:29 +0000 |
---|---|---|
committer | Andrew White <andrew.white@unboxed.co> | 2017-02-21 15:30:46 +0000 |
commit | 7d1e738057cead1970d8aca31310a51a59f7235f (patch) | |
tree | 2024573a36d9ffd6ba20e555ef9999598cd9fd0c /actionpack | |
parent | e96da0a7beb483ed5e8a8096ff67b09ecc5ca7a1 (diff) | |
download | rails-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.rb | 2 | ||||
-rw-r--r-- | actionpack/lib/action_dispatch/routing/route_set.rb | 6 |
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 |