aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2010-05-15 17:43:35 -0300
committerAaron Patterson <aaron.patterson@gmail.com>2010-11-17 17:15:25 -0800
commitc6bfd6802ae4c8e179e875a707ec42bf73d13a20 (patch)
treedda700f5c839ad3aebd63fe693e8983fb91563eb /activerecord/test
parent00693209ecc222842949d7cab076f89890cbd507 (diff)
downloadrails-c6bfd6802ae4c8e179e875a707ec42bf73d13a20.tar.gz
rails-c6bfd6802ae4c8e179e875a707ec42bf73d13a20.tar.bz2
rails-c6bfd6802ae4c8e179e875a707ec42bf73d13a20.zip
When use where more than once on the same column, relation doesn't do an 'or' or 'in' with the values
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/relations_test.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb
index e39b1f396c..6649923421 100644
--- a/activerecord/test/cases/relations_test.rb
+++ b/activerecord/test/cases/relations_test.rb
@@ -451,6 +451,15 @@ class RelationTest < ActiveRecord::TestCase
assert_equal author, authors
end
+ def test_find_all_using_where_twice_should_or_the_relation
+ david = authors(:david)
+ relation = Author.unscoped
+ relation = relation.where(:name => david.name)
+ relation = relation.where(:name => 'Santiago')
+ relation = relation.where(:id => david.id)
+ assert_equal [david], relation.all
+ end
+
def test_exists
davids = Author.where(:name => 'David')
assert davids.exists?