Great ! that does the trick. Just having a litte trouble understanding the notation :| in inject, what does that mean. I tested '|' also works but i don't know why :)
On Nov 23, 11:24 pm, Jeremy Evans <[email protected]> wrote: > On Nov 23, 11:20 am, _dewie_ <[email protected]> wrote: > > > I understand, but the problem is that i don't know the columns when > > writing te code. > > I get lots of information in a hash, so i have to build the dataset in > > a loop > > > Any idea ? > > Assuming a hash such as: > > h = {:certificate_number => '01', :location => '02'} > > then: > > ds = DB[:certificates]. > filter(:certificates__customer_id=>4) > ds.filter(h.map{|k,v| k.ilike("%#{v}%")}.inject(:|)) > > Jeremy -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sequel-talk?hl=en.
