RoR: Search Logic, How do I use OR with two different values on the same field?

85 views Asked by At

I want to do something similar to : @search(some_condition or some_other_condition)

this is how the internet says to use OR http://www.binarylogic.com/2009/08/26/using-searchlogic-to-combine-named-scopes-with-or/

unfortunately it only uses the same value for two fields.

So.. IS there a way to do @search.(some_field == value OR other_field == other_value) ?

1

There are 1 answers

3
theIV On BEST ANSWER

Don't resort to searchlogic for the or part, just use ruby.

result = @search.first_name_like('The') || @search.last_name_like('LindyHop')

Is there a reason that I'm not following as to why you can't do it like this?