On Friday, October 11, 2013 6:49:22 AM UTC-7, Jamie Hodge wrote:
> Hi Jeremy,
>
> How do I create an xor constraint along the lines of:
>
> check { "(column_a not null)::integer + (column_b not null)::integer = 1" }
>
Assuming you want to allow the case where either is nil or when both are
not nil, that the sum is 1:
Sequel.|({:column_a=>nil}, {:column_b=>nil}, {Sequel.expr(:column_a) +
:column_b =>1})
Note that if you want to use plain SQL, you can just pass a string to check.
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 http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/groups/opt_out.