rails/rails — pull request #16502 by bogdan (2014-08-14 10:48:13+00:00)
Title: [Regression 4.0 -> 4.1] Fixed AR::Relation#where edge case with Hash and other Relation

Example:

``` ruby
Author.where(posts: { author_id: Author.where(country_id: 1) }).joins(:posts)
```

AR dont handle it properly right now because it only search for relation at first level of hash values, but not for nested hashes