Hi all,
I have 2 models let's say `Model` and `Event`.
`Model` has `one_to_many` association to `Event`.
`Event` has column `event_type` which indicates the event happened on a
`Model`.
`event_type` could be `do_something` or `undo_something` or
`some_others_action`.
I would like to return a `dataset` in which:
- if there is no `do_something` or `undo_something` event
-- return all columns in `Model` plus `did_something` column as
`false`.
- if there is `do_something` and no `undo_something` event
-- return all columns in `Model` plus `did_something` column as
`true`.
- if there is `do_something` and `undo_something` event. And `created_time`
of last `do_something` is greater than `created_time` of last
`undo_something`
-- return all columns in `Model` plus `did_something` column as
`true`.
- if there is `do_something` and `undo_something` event. And `created_time`
of last `do_something` is less than `created_time` of last `undo_something`
-- return all columns in `Model` plus `did_something` column as
`false`.
Is there anyway I accomplish it using `dataset_module`?
I do not want to use Ruby code to iterate through a join and manually
calculate the `did_something` value.
Thank you very much in advance
Bang
--
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.