When looking at comments which will be made on different types (say
post, picture, article) I see a lot of advice towards using polymorphic
associations for this. Ryan Bates has a good railscast on it:
http://railscasts.com/episodes/154-polymorphic-association-revised
However, I'm not sure I see why this is such a good idea in this case.
Would it not make more sense to have multiple comment types:
PostComment < Comment
PictureComment < Comment
etc.
Now we have the same amount of comment rows and we maintain referential
integrity, although we do now have more tables..
Can someone point me in the direction of why polymorphic associations
are the way to go rather than using inheritance and multiple tables in
the db? Does it make much difference?
--
Posted via http://www.ruby-forum.com/.
--
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/f98bb2307ce8ccab226c17b74a9be722%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment