I think it depends on your use case. Things to consider:

1. Selecting all comments of a user via 1 association or N associations
(and 1 vs N queries).
2. Storing more data in the table (:commentable_type).
3. Maintaining and testing one model vs testing N models.

I think the biggest problem with separate comment models is that references
from other models are the fact that you need N times more associations to
reference a comment (e.g. user.post_comments, user.picture_comments, ...
instead of user.comments).

You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAA6WWt-7%3DrrEpcs%2B84m9EiDCZa-XDKDAfAKrnuMvCKxkfCgUjg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Discussion Posts


Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 2 of 2 | next ›
Discussion Overview
grouprubyonrails-talk @
postedMay 16, '16 at 12:51p
activeMay 24, '16 at 11:06a

2 users in discussion

Greg Navis: 1 post Johnny Stewart: 1 post



site design / logo © 2021 Grokbase