On Friday, June 3, 2011 3:09:55 PM UTC-4, pavling wrote: > > On 3 June 2011 19:19, Tim Shaffer <timsh...@me.com> wrote: > > I think the problem with doing that is that the arrays contain instances > of > > models. > > I .uniq arrays of instances of models all the time - it's a very handy > tool. > Agreed, but it doesn't solve the problem when you only want unique instances based on *some* of the fields.
> > Sounds like skt wants to consider an instance unique based on only two > > attributes of each instance. > > If so, then collecting up just those values and .uniq on them would > still be readable, as a one liner or broken into a couple, or doing a > .group_by and checking the size of the hash.... > Agreed once again, but that only gets you the unique address_ids and user_ids, not the full instances. Not sure if that would matter for his requirements Cheers! -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/N1FHSjRsVDNqcGdK. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.