rails/rails — pull request #16755 by codeodor (2014-08-30 22:26:25+00:00)
Title: Allow polymorphic routes with nil when a route can still be drawn

Suppose you have two resources routed in the following manner:

```ruby
resources :blogs do
resources :posts
end

resources :posts
```

When using polymorphic resource routing like `url_for([@blog, @post])`, and `@blog` is `nil` Rails should still try to match the route to the top-level posts resource.

Fixes #16754