use quoted id of single AR::Base objects in predicates
This commit is contained in:
parent
e4591489d1
commit
dcdfc84f55
@ -25,6 +25,8 @@ def self.build_from_hash(engine, attributes, default_table)
|
||||
attribute.in(values)
|
||||
when Range, Arel::Relation
|
||||
attribute.in(value)
|
||||
when ActiveRecord::Base
|
||||
attribute.eq(value.quoted_id)
|
||||
else
|
||||
attribute.eq(value)
|
||||
end
|
||||
|
@ -426,6 +426,12 @@ def test_find_in_empty_array
|
||||
assert_blank authors.all
|
||||
end
|
||||
|
||||
def test_where_with_ar_object
|
||||
author = Author.first
|
||||
authors = Author.scoped.where(:id => author)
|
||||
assert_equal 1, authors.all.length
|
||||
end
|
||||
|
||||
def test_exists
|
||||
davids = Author.where(:name => 'David')
|
||||
assert davids.exists?
|
||||
|
Loading…
Reference in New Issue
Block a user