mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
When use where more than once on the same column, relation doesn't do an 'or' or 'in' with the values
This commit is contained in:
committed by
Aaron Patterson
parent
00693209ec
commit
c6bfd6802a
@@ -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?
|
||||
|
||||
Reference in New Issue
Block a user