Maintaining clean tables



I’m working on the Agile book and since the beginning of the book I’ve
been wonder how either Rails maintains clean tables or if I have to
build a method myself.

For those following the Agile book this is about Iteration 9.1, the
checkout page and customer details table. If you checkout as the same
customer twice, all the data is entered as a new entry. What I want is
to either insert new data or use existing data, especially if I am
mixing those id’s in a join table later.

Is anybody else doing the same thing who could give me some advice?

Thank a lot,