Rails Polymorphic Children
I've seen many good examples of a child model (say, a 'Comment') belonging
to multiple parent models ('Post', 'Product', etc). Here is one, for
example: http://railscasts.com/episodes/154-polymorphic-association.
I am looking to accomplish the opposite however, where a parent has
multiple polymorphic children. A classic example would be an
'ActivityFeed' that has multiple types of children ('Photo', 'Comment',
etc).
How would one go about modeling this relationship in Rails?
No comments:
Post a Comment