Reputation: 5
I need to loop through an array called @ads and delete all objects in it that are duplicates of one another. how do i do this?
Upvotes: 0
Views: 389
Reputation: 160843
The below code will give you the result uniqic by id.
@ads = @ads.uniq{|ad| ad.id}
Upvotes: 4