diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2014-08-14 11:08:25 -0300 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2014-08-14 11:08:25 -0300 |
commit | 71e8f199d75fcad804c6a36e089b6b8fb4071192 (patch) | |
tree | 53815e3078eb1c2278b9f6cb095daa8e5b015e3c /activerecord/test | |
parent | dfc3f8831189ca762b942571182228bd2d37ac53 (diff) | |
parent | fe67dfbbeea092f0f42e81e4901fe9a949cf9484 (diff) | |
download | rails-71e8f199d75fcad804c6a36e089b6b8fb4071192.tar.gz rails-71e8f199d75fcad804c6a36e089b6b8fb4071192.tar.bz2 rails-71e8f199d75fcad804c6a36e089b6b8fb4071192.zip |
Merge pull request #16502 from bogdan/where-hash-nested-relation
[Regression 4.0 -> 4.1] Fixed AR::Relation#where edge case with Hash and other Relation
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/relation/where_test.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/activerecord/test/cases/relation/where_test.rb b/activerecord/test/cases/relation/where_test.rb index a6a36a6fd9..b4804aa9d7 100644 --- a/activerecord/test/cases/relation/where_test.rb +++ b/activerecord/test/cases/relation/where_test.rb @@ -61,6 +61,15 @@ module ActiveRecord assert_equal expected.to_sql, actual.to_sql end + def test_belongs_to_nested_where_with_relation + author = authors(:david) + + expected = Author.where(id: author ).joins(:posts) + actual = Author.where(posts: { author_id: Author.where(id: author.id) }).joins(:posts) + + assert_equal expected.to_a, actual.to_a + end + def test_polymorphic_shallow_where treasure = Treasure.new treasure.id = 1 |