This is right way for database?

Posted by ciss on Stack Overflow See other posts from Stack Overflow or by ciss
Published on 2010-05-28T14:40:16Z Indexed on 2010/05/28 15:12 UTC
Read the original article Hit count: 133

Hello, i have some issue with database.

Okay, i have two models -> Page and Item. Page for displaying some content. Item -> this is item discription.

So, i work on small ecommerce shop.

Okay, all of this models can have some comments.

So, this is my Comments model at this moment:

Comments ->

string : id
text : body
integer : page_id
integer : item_id

So when some one add comment to page -> page_id will be filled with current Page id.

And if some one add comment to item -> item_id will be filled.

Okay, i know what the best way is to create STI or Polymorphic assoc, but does i really need this way for my situation?

Sorry for my bad english, i'm from Russia.=)

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about database-design