0
我有Match
模型和我有Player
模型。 现在我想添加到Match
两个字段,如:playerone
和playertwo
。 我想playerone
有一个参考具体Player
对象和playertwo
有一个参考另一个Player
对象了。在模型中的两个filelds与参考相同的模型
我是想这样的事情:
rails g model Match player:references
但这种方式我可以只创建一个域。我无法为此字段创建自定义名称。
或者我可以创建playerone:integer
存档并放在这里播放器的id(在控制器中)。但可以吗?