I'm curious to know why the creation of the purchases table is necessary? It doesn't seem as if anything is ever stored there. The @purchases array holds the Cart information, which is stored as a session variable. Would it not be better to just create the Purchase object and not bother with the table? Or is the table there merely to allow for referential integrity to be enforced?