0
我想實現一個遊戲模型,它有兩個團隊和兩個分數。一個團隊是一個玩家列表。導軌 - 模型設計 - 引用兩個相同型號的列表
class Game < ActiveRecord::Base
has_many :players, :name => 'Team1' # I'd like this to be the first team
has_many :players, :name => 'Team2' # and this to be the second team
attr_accessible :score1 #the first team's score
attr_accessible :score2 #the second team's score
end
class Player < ActiveRecord::Base
attr_accessible :name
end
任何解決方案來實現這個?我不知道這是否可能。謝謝!