Support for `where()` queries that use `has_many` association names.

Support for association names in `where` queries previously worked
for `belongs_to` associations, but not for `has_many` associations.
The SQL generated for `has_many` queries would actually be very
confusingly wrong, using the wrong table and column entirely.

Given:

    class Author < ActiveRecord::Base
      has_many :posts
    end

The existing behavior is as follows:

    authors_of_published_posts = Author.where(posts: { id: Post.where(published: true) }).joins(:posts)

This commit adds support for this style of where conditions:

    authors_of_published_posts = Author.where(posts: Post.where(published: true)).joins(:posts)