Well, that's other one task and not just .uniq. Magic unuseful :)
You'd better to write much more complex clause:
(array1 + array2 + arrayN).group_by { |instance| [instance.user_id, address_id]
}.values.collect { |array| array.sort {|a,b| a.distance <=> b.distance}.first}
On 04.06.2011, at 0:13, skt wrote:
> What I need to do is get unique user_id/address_id records with the
> shortest distance.
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.