From: Hassan Schroeder Date: 2012-12-11T01:51:05+09:00 Subject: Re: Array of a class' attribute On Mon, Dec 10, 2012 at 7:49 AM, Leo M. wrote: > I'm working on a DB that has the rows structured as a ruby class called > Result, structured as follows: > > class Result > attr_accessor :name, :link, :messages > end > The catch is that there are a lot of doubles in terms of LINK attribute. > I'm trying to create a method that erases all the Result(s) that shares > the same :link attribute with another Result. So you need to write two methods: 1) one that accesses the DB to remove a specified row, and 2) one that identifies which rows to remove. For #2 you need to define which duplicate you want to keep: first? last? based on some other criteria? This might be a good time to start writing tests :-) HTH, -- Hassan Schroeder ------------------------ hassan.schroeder@gmail.com http://about.me/hassanschroeder twitter: @hassan