#743 ✓not-applicable
Tony Pitale

Unique as an aggregate

Reported by Tony Pitale | January 3rd, 2009 @ 10:49 PM

Animal.unique(:name) where name is a property, returning an array would, I think, be a fantastic addition to dm-aggregates. I have a fork on github (http://github.com/tpitale/dm-mor... with the changes to make this happen but, I don't know that it is the best way to go about it.

Comments and changes to this ticket

  • Tony Pitale

    Tony Pitale January 3rd, 2009 @ 11:03 PM

    Nevermind, I'll just add to the documentation that with dm-aggregates you can do the following (sticking with the animal analogy)

    Animal.aggregate(:name, :unique => true)

  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) January 4th, 2009 @ 03:17 AM

    Tony, should I mark this ticket as not applicable? I noticed your fork has DISTINCT, but if you can get the same functionality with :unique => true, it would probably be better to just use that, since it plays nicely with aggregate functions.

  • Tony Pitale

    Tony Pitale January 4th, 2009 @ 04:05 PM

    Yeah, that should be fine. I have yet to research what the true benefits of distinct over the way unique is done would be. I do however, think it would be important to document this method for the future.

  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) January 4th, 2009 @ 11:35 PM

    • State changed from “unconfirmed” to “not-applicable”

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

People watching this ticket