binarylogic / searchlogic

Searchlogic provides object based searching, common named scopes, and other useful tools.
http://rdoc.info/projects/binarylogic/searchlogic
MIT License
1.39k stars 133 forks source link

field_equals with array fails using search()/searchlogic() #81

Closed zacheryph closed 6 years ago

zacheryph commented 14 years ago

one of the examples, works as a stand alone scope but not when used in Model#searchlogic()

User.username_equals(["bjohnson", "thunt"])

This is locally on current app with code from commit (d6225e982aba)

>> Zone.type_equals('State').count
=> 50
>> Zone.type_equals(['State', 'Province']).count
=> 61
>> Zone.search({:type_equals => 'State'}).count
=> 50
>> Zone.search({:type_equals => ['State', 'Province']}).count
/Users/zacheryph/src/cserp/vendor/plugins/searchlogic/lib/searchlogic/named_scopes/conditions.rb:116: warning: multiple values for a block parameter (2 for 1)

However. using field_equals_any in searchlogic() does work. Is there a reason there is a differentiation between the two and they dont match eachother?

graywh commented 14 years ago

They don't do the same thing. Note that Model.field_is_any([]).count == Model.count.

zacheryph commented 14 years ago

I was pointing Out That search() requires using a named_scope. These named Scopes made by search logic. The named scope directly and "the named scope" that search() is hitting do not match. Why would they differ?

graywh commented 14 years ago

Also, this might be a duplicate of issue #64.

graywh commented 14 years ago

And issue #57.