Is there any way to define a has_one style association between models where the association can be with an instance of one of two different models? In particular, I have the following models:
Post
Comment
A user makes a post, and other users can comment on it. But users can also comment on other comments (a la Facebook threads). I'm trying to reflect this relationship in my project by saying that a Comment can have a Target (and that Target can either be a Post or another Comment).
I thought that this would best be done with a has_one association, but as far as I can find, has_one associations can only be used to associate one model with a single other model.
How can I implement a has_many (or another similarly formatted) relationship between these models?