diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-07-30 16:21:04 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-07-30 16:21:04 -0300 |
commit | f8e81d41200d9310c95dd397d65f745aa6f45d3a (patch) | |
tree | 0934ec6fc1f935deb517fc9e8f3f1ca8e5e974ba | |
parent | 5373bf228d1273deae0ed03370ec4a63c580422b (diff) | |
parent | 32133db710600d66f41e998359328b8e6104630b (diff) | |
download | rails-f8e81d41200d9310c95dd397d65f745aa6f45d3a.tar.gz rails-f8e81d41200d9310c95dd397d65f745aa6f45d3a.tar.bz2 rails-f8e81d41200d9310c95dd397d65f745aa6f45d3a.zip |
Merge pull request #21075 from byroot/not-empty-vs-any
Array#any? is slower and not the inverse of Array#empty?
-rw-r--r-- | actionpack/lib/action_dispatch/journey/formatter.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/actionpack/lib/action_dispatch/journey/formatter.rb b/actionpack/lib/action_dispatch/journey/formatter.rb index d839fec48d..d8bb10ffab 100644 --- a/actionpack/lib/action_dispatch/journey/formatter.rb +++ b/actionpack/lib/action_dispatch/journey/formatter.rb @@ -25,7 +25,7 @@ module ActionDispatch next unless name || route.dispatcher? missing_keys = missing_keys(route, parameterized_parts) - next if missing_keys && missing_keys.any? + next if missing_keys && !missing_keys.empty? params = options.dup.delete_if do |key, _| parameterized_parts.key?(key) || route.defaults.key?(key) end @@ -40,7 +40,7 @@ module ActionDispatch end message = "No route matches #{Hash[constraints.sort_by{|k,v| k.to_s}].inspect}" - message << " missing required keys: #{missing_keys.sort.inspect}" if missing_keys && missing_keys.any? + message << " missing required keys: #{missing_keys.sort.inspect}" if missing_keys && !missing_keys.empty? raise ActionController::UrlGenerationError, message end |