Thank you. On Tuesday, 1 June 2021 at 15:02:11 UTC+8 Jeremy Evans wrote:
> On Mon, May 31, 2021 at 8:59 PM Adam Aiken <[email protected]> wrote: > >> Hi, I am trying to have additional conditions on association. >> >> Say typically it looks like: >> >> class Post < Sequel::Model >> one_to_many: :comments, conditions: { time_deleted: nil } >> end >> >> However, I want to do the opposite like `time_deleted` is not nil. >> Does sequel support such operation for conditions? >> > > Yes. In this case, you can use: > > class Post < Sequel::Model > one_to_many: :comments, conditions: { time_deleted: Sequel::NOTNULL } > end > > For generic negation, you can use Sequel.~: > > class Post < Sequel::Model > one_to_many: :comments, conditions: Sequel.~({ time_deleted: nil }) > end > > 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 view this discussion on the web visit https://groups.google.com/d/msgid/sequel-talk/eca025c5-4160-4e6f-8b52-4aa7305b58f3n%40googlegroups.com.
