Is it OK to manage associations manually?

Posted by sosborn on Stack Overflow See other posts from Stack Overflow or by sosborn
Published on 2010-04-06T02:53:22Z Indexed on 2010/04/06 3:23 UTC
Read the original article Hit count: 217

Filed under:

Here are the relevant models:

User Product Order

A User can sell or buy products An order has a buyer, a seller and one product

I know that I can do this with a HABTM relationship between orders and user, but is seems to me like it would be simpler to put in the Order table the following columns:

:seller_id :buyer_id

and manage those relationships manually as orders are only created once and never edited. However, this doesn't seem very Rails-like and I am wondering if I am missing something conceptually at the HABTM relationship.

© Stack Overflow or respective owner

Related posts about ruby-on-rails