diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-11-26 11:34:03 -0200 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-11-26 11:34:03 -0200 |
commit | b0328eabd1cf2c2e58208b19131e7eff66dea453 (patch) | |
tree | 3339de9363463a98b1f9ff50ae984c6814355ef4 /actionpack | |
parent | 73a7192394ad628b91894b18f77ab31de628ba5b (diff) | |
parent | 9530c5786e621bcafa68a2eab3021ccd9a930e52 (diff) | |
download | rails-b0328eabd1cf2c2e58208b19131e7eff66dea453.tar.gz rails-b0328eabd1cf2c2e58208b19131e7eff66dea453.tar.bz2 rails-b0328eabd1cf2c2e58208b19131e7eff66dea453.zip |
Merge pull request #17784 from bruno-/refactor-nested-ifs
Refactor nested if
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index be54d43172..a8be77f46d 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -244,12 +244,10 @@ module ActionDispatch def app(blocks) if to.respond_to?(:call) Constraints.new(to, blocks, false) + elsif blocks.any? + Constraints.new(dispatcher(defaults), blocks, true) else - if blocks.any? - Constraints.new(dispatcher(defaults), blocks, true) - else - dispatcher(defaults) - end + dispatcher(defaults) end end |