0

我有四个模型和这些关联

forums
  belongs to user
  has many topics
topics
  belongs to user AND forum (at the same time)
  has many posts
posts
  belongs to topic AND user (at the same time)
users
  has many forums
  has many topics
  has many posts

我想弄清楚的问题是如何处理

topics  
  belongs to user AND forum (at the same time)
posts
  belongs to topic AND user (at the same time)

似乎常规的多态关联仅支持您有 EITHER OR 场景而不是 AND 场景的情况。

因此,例如,我认为常规多态关联只支持这样的情况

comments
  belongs to EITHER photo OR blog

代替

comments
  belongs to posts AND commenter

常规的多态关联会起作用吗?如果没有,我还有什么其他选择?

4

0 回答 0