rails/rails — pull request #10912 by Bertg (2013-06-11 11:02:57+00:00)
Title: Preloading associations that don't exist should not raise an error

Today when pre loading associations each association should exist or an error gets thrown. This is not strictly needed as the "wrong" association can just be ignored.

Even more, it could be useful in the case of polymorphic situations. eg:

```ruby
Story.includes(subject: [:comments, :thumbnail])
```

Now imagine that subject here is polymorphic and some of the classes in that query do not have a thumbnail association. Now a developer has to deal with n+1 queries, due to the raise. It would be nice if ActiveRecord loads the associations when it can, and silently fails when it can't.

One could argue that the code should at least show a warning, but I believe that tools like Bullet are better suited.