[LRUG] Better idiom for this?

Michael Pavling pavling at gmail.com
Thu Feb 28 04:44:47 PST 2013


On 28 February 2013 12:26, Paul Battley <pbattley at gmail.com> wrote:

> Oh, and whatever you do, DON'T call the scope "except". You'll waste
> half a day wondering why composing scopes doesn't work as it ought.
>

After a bit of playing around, it's apparent that I don't need to delete
blank elements either, so I've gone back to a scope, which currently looks
like this:

  scope :excluding, lambda { |*objects| where(['id NOT IN (?)',
(objects.flatten << 0)]) }

Cheers for all the input :-)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20130228/8f2ad7fa/attachment-0003.html>


More information about the Chat mailing list