rails/rails — pull request #13886 by arthurnn (2014-01-30 02:23:59+00:00)
Title: Fix regression on .select method

### Problem
```ruby
query = author.posts.select(:title)
connection.select_one(query)
```
That code wont work anymore on rails 4. And it used to work on rails 3.

### Why
`select` method, returns a `ActiveRecord::AssociationRelation` and the connection is not expecting that object.

### Solution
If the argument is a `ActiveRecord::AssociationRelation`, get the arel and binds from it.

review @rafaelfranca @dmathieu

See this example that fails on AR 4 and not on 3:
https://gist.github.com/arthurnn/8701203