On Wednesday, April 27, 2016 at 6:13:42 AM UTC-7, The Bang Nguyen wrote: > > Hi Jeremy, > > I thought I got your idea, but I did not. > Sorry for bothering you again. > > >do_something = > event_ds.where(:event_type=>'do_something').max(:created_time) > If there is any `event` with `event_type` is `do_something`, do_something > will always be not nil. > Thus `did_something` will be always true. > > For example: > Lets say I have 2 `model`(s). > First one have `event` with `event_type` is `do_something`. Second one > does not have any event. > With your code, I will receive dataset in which both `did_something` for 2 > `model` are `true`. > > My expectation is to get back the dataset in which `did_something` for > first `model` is `true` and second one is `false` >
Ah, then you'd probably have to select a CASE expression with a subquery using similar logic as my earlier example. Try giving that a shot. If you can't get it to work, please post here with your attempt. Thanks, Jeremy -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/sequel-talk. For more options, visit https://groups.google.com/d/optout.
