Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Support "or" for separate conditions #29

Closed
ryanb opened this Issue · 1 comment

1 participant

@ryanb
Owner

While it is possible to perform an "or" condition on one attribute:

search(:conditions => { :priority => [3, 5] })

It is currently not possible to perform an "or" on separate attributes.

search(:conditions => { :priority => 3, :category => "foo" }) # does an AND search

One possible solution is to support an "or_search" method which can be chained. For example.

search(:conditions => { :priority => 3 }).or_search(:conditions => { :category => "foo" })

Another solution is to use an array in the conditions call.

search(:conditions => [{ :priority => 3 }, { :category => "foo" }])

I think I prefer this latter approach.

@ryanb
Owner

search multiple conditions with OR by passing an array - closed by b7c78e7

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.