diff options
author | Damien Mathieu <42@dmathieu.com> | 2012-07-05 13:24:59 +0200 |
---|---|---|
committer | Damien Mathieu <42@dmathieu.com> | 2012-09-19 15:57:22 +0200 |
commit | 30a576fa145a8a7d7f68ac295addb24465baf39a (patch) | |
tree | b482e9f057996bcd5b7e7b29f921486d97d5c39b /activerecord/test | |
parent | f4ad0ebe7a6b17658bddfeb996e3c34835b75623 (diff) | |
download | rails-30a576fa145a8a7d7f68ac295addb24465baf39a.tar.gz rails-30a576fa145a8a7d7f68ac295addb24465baf39a.tar.bz2 rails-30a576fa145a8a7d7f68ac295addb24465baf39a.zip |
fix querying with an empty hash
Closes #6960
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/relation/where_test.rb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/activerecord/test/cases/relation/where_test.rb b/activerecord/test/cases/relation/where_test.rb index 3163cf79ad..9c0b139dbf 100644 --- a/activerecord/test/cases/relation/where_test.rb +++ b/activerecord/test/cases/relation/where_test.rb @@ -4,10 +4,11 @@ require 'models/price_estimate' require 'models/treasure' require 'models/post' require 'models/comment' +require 'models/edge' module ActiveRecord class WhereTest < ActiveRecord::TestCase - fixtures :posts + fixtures :posts, :edges def test_belongs_to_shallow_where author = Author.new @@ -76,5 +77,13 @@ module ActiveRecord post = Post.first assert_equal post, Post.where(:posts => { 'id' => post.id }).first end + + def test_where_with_table_name_and_empty_hash + assert_equal 0, Post.where(:posts => {}).count + end + + def test_where_with_empty_hash_and_no_foreign_key + assert_equal 0, Edge.where(:sink => {}).count + end end end |