diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2014-08-31 13:06:13 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2014-08-31 13:06:13 -0700 |
commit | ba7d35c6b79eb9f1ca60462b822cbc08644e950a (patch) | |
tree | cebf276674305c090572c378d8a68fe93afdee06 /actionpack/lib/action_dispatch | |
parent | 0db179a99804de0c26eb4a0dfd91986ffaa2a4dc (diff) | |
parent | 2fae37f0acbb4154fe75c22a892f79e158016866 (diff) | |
download | rails-ba7d35c6b79eb9f1ca60462b822cbc08644e950a.tar.gz rails-ba7d35c6b79eb9f1ca60462b822cbc08644e950a.tar.bz2 rails-ba7d35c6b79eb9f1ca60462b822cbc08644e950a.zip |
Merge pull request #16755 from codeodor/master
Allow polymorphic routes with nil when a route can still be drawn
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/polymorphic_routes.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb b/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb index 427a5674bd..f15868d37e 100644 --- a/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb +++ b/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb @@ -197,7 +197,8 @@ module ActionDispatch case record_or_hash_or_array when Array - if record_or_hash_or_array.empty? || record_or_hash_or_array.include?(nil) + record_or_hash_or_array = record_or_hash_or_array.compact + if record_or_hash_or_array.empty? raise ArgumentError, "Nil location provided. Can't build URI." end if record_or_hash_or_array.first.is_a?(ActionDispatch::Routing::RoutesProxy) |