diff options
author | Jean Boussier <jean.boussier@gmail.com> | 2014-08-17 07:55:42 -0400 |
---|---|---|
committer | Jean Boussier <jean.boussier@gmail.com> | 2014-08-17 07:55:42 -0400 |
commit | 6fdf5167b7a49a4cdd9d47570ddcebcbbf808e99 (patch) | |
tree | 51876b0df48b1d87edabac5de66612f6e0d477df /activerecord/test/cases/relation | |
parent | d20270612cd9be3eed910171934a6b3463dbead7 (diff) | |
download | rails-6fdf5167b7a49a4cdd9d47570ddcebcbbf808e99.tar.gz rails-6fdf5167b7a49a4cdd9d47570ddcebcbbf808e99.tar.bz2 rails-6fdf5167b7a49a4cdd9d47570ddcebcbbf808e99.zip |
Add a test case of nested empty array values in conditions
Post.where(id: [[]]).to_a
Used to fail with a SQL syntax error (until 4.1):
SELECT ... WHERE id in ();
It now properly generate:
SELECT ... WHERE 1=0;
Diffstat (limited to 'activerecord/test/cases/relation')
-rw-r--r-- | activerecord/test/cases/relation/where_test.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/activerecord/test/cases/relation/where_test.rb b/activerecord/test/cases/relation/where_test.rb index b4804aa9d7..580ea98910 100644 --- a/activerecord/test/cases/relation/where_test.rb +++ b/activerecord/test/cases/relation/where_test.rb @@ -180,6 +180,10 @@ module ActiveRecord assert_equal 0, Post.where(:id => []).count end + def test_where_with_table_name_and_nested_empty_array + assert_equal [], Post.where(:id => [[]]).to_a + end + def test_where_with_empty_hash_and_no_foreign_key assert_equal 0, Edge.where(:sink => {}).count end |