--000e0cd13a845bbbd8048300e5be Content-Type: text/plain; charset=ISO-8859-1 On Tue, Mar 30, 2010 at 2:38 AM, Derek Cannon <novellterminator / gmail.com>wrote: > > Primary keys and unique indexes in the database ensure that you don't > > have duplicated rows. > > Are you using ActiveRecord? > > I don't even know what that means yet. I just started with Rails a few > days ago. I just created a project, created a database with the fields I > want, and used scaffold. I can add/edit/delete elements of my database, > that's pretty much all. I've already written a class that will parse XML > files for data, load that data into an array of instantiated classes > called "Movie". For example, each Movie class has a title, rating, plot, > etc. I just want to make sure the movie's title and release date don't > already exist in a database before I add them. For example, I was > thinking of something like this: > > # @movie_db is the Rails SQLite3 database > # @movies holds the temporary array of all the Movie classes, > #each which have many variables: title, rating, plot, etc > > @movies.each { |i| > if @movie_db.find { |x| (x["title"] i.title) and > x["release_year"] x.release_year } false > @movie_db ovieDb.new("title"