Scott Olmsted wrote:
> 
> There's no 'Save For Later', and there's no 'Empty Cart' or 'Discard Cart'.
> 
> While carts are never removed from the database, they are discarded 
> after the gateway reports acceptance of the payment:
> 
>         @cart.user_id = nil
>         @cart.save

That breaks the rule "thou shalt not delete, overwrite, or destroy data".

Ideally, a database - especially e-commerce related - should only add new 
records. "Destroy" a cart by adding another one, and then the user only ever 
sees the cart with the highest timestamp. Rails's model observers and named 
scopes should make these features trivial to add. Should.

Also, it might be time for the "got unit tests" question. RoR makes them sooo 
tragically easy...

-- 
   Phlip
   http://c2.com/cgi/wiki?MoreliaViridis

-- 
SD Ruby mailing list
[email protected]
http://groups.google.com/group/sdruby

Reply via email to