I have a function which runs a Conditional where query using a hash in order to chain conditions with an AND also.
hash = {:cond1 => 6, :cond2 => 3, :cond3 => 7}
Object.where(hash)
This seems to work fine for me.
The problem is ,if I had an array of those hashes for example:
ary = [{:cond1 => 6, :cond2 => 3, :cond3 => 7},{:cond4 => 6, :cond5 => 3, :cond6 => 7},....]
How could I dynamically chain every hash after ary[0] as an OR clause to a where query like so:
Object.where(ary[0]).or(ary[1]).or(ary[2])....
I think I may have to use lambdas or a block but I'm not sure how to implement it.