Smart way to add comments possibility on a model base to an app?

What would be a smart way to Add a comment form and lists comments on a per model base?

Im building a social networking site and would like to have comments on certain contents. I could add a comment form for every model manually but what would be a better way to have comments added on a per model base ? Where I could add something in the model and it would include the comments, + new comment form?

Thx!

rubybox wrote:

What would be a smart way to Add a comment form and lists comments on a per model base?

Im building a social networking site and would like to have comments on certain contents. I could add a comment form for every model manually but what would be a better way to have comments added on a per model base ? Where I could add something in the model and it would include the comments, + new comment form?

Thx!

A comment is a comment is a comment, and as such, you need only one comment form. You should read up on partials, and multi-part forms (railscasts [ http://railscasts.com/ ] has some very good episodes that would answer your questions IIRC.

If you want your comments related to multiple models, then you should look into polymorphic associations.

All eminently do-able in Rails.