On Jul 19, 6:36 am, Michael Lang <[email protected]> wrote:
> I'm having a little trouble getting an OR conditional right...
>
> "WHERE date_corrected is NULL or date_corrected < '2011-06-01'"
>
> dataset.filter({:date_corrected => nil} | {:date_corrected <
> Date.civil(2011,6,1)})
>
> Gives me "odd number list for Hash"
>
> How can I do this?

You are using {} when you should be using ()

dataset.filter({:date_corrected => nil} | (:date_corrected <
Date.civil(2011,6,1)))

Note that your code won't work on 1.9.  You need to do this to work on
both 1.8 and 1.9:

dataset.filter{{date_corrected => nil} | (date_corrected <
Date.civil(2011,6,1))}

Also, if the dataset is not already filtered, this is probably
equivalent and would be my recommendation:

dataset.filter(:date_corrected => nil).or{date_corrected <
Date.civil(2011,6,1)}

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.

Reply via email to