Say i want to generate the following sql statement with chaining:

select count(*) from certificates
where (certificates.customer_id = 4) and ((certificate_number ilike
'%01%') or "location" ilike '%02%')

The client_id is the base that all records have to have, in this case
i filter on certificate_number and location, this can be a lot more
columns

I tried chaining :

Certificate.filter(:customer_id =>
4).or(:certificate_number.ilike('%01%')).or(:location.ilike('%02%')

But then customer_id get's optional to.

I know i can get this result with | in a filter statement but i would
like to chain the filters so i can walk easily in my hash i receive.

Any Ideas ?


-- 
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.

Reply via email to