rails: best way to store comments in mysql

Posted by ciss on Stack Overflow See other posts from Stack Overflow or by ciss
Published on 2010-03-13T15:41:34Z Indexed on 2010/03/13 15:45 UTC
Read the original article Hit count: 187

Filed under:

Hello.

Okay i have two models: posts and comments. as you can think comments has column :post_id.

My models

Comments

  • belongs_to :post

Post

  • has_many :comments

So, this is pretty simple association but i have some problems with ordering comments. at first time, when i create my comments migration file i just add column :position. This column indicate comment position in the post.

But now i think what where is more good way to do this.

so i can't make my choise:

1) uses t.column :datatime :created_at, :default => Time.now()

2) or use timestamps? this is undiscovered for me, please tell me about your exp.

© Stack Overflow or respective owner

Related posts about ruby-on-rails