0
目前,我有以下型号:为什么在使用has_many时不能使用rails 3找到我的关联?
class Player < ActiveRecord::Base
belongs_to :team
belongs_to :user
end
class Team < ActiveRecord::Base
has_many :users, :through => :players
end
class User < ActiveRecord::Base
has_many :teams, :through => :players
end
当我做前端以下
<%= @team.users %>
我得到异常:
找不到关联:玩家模型团队
,当我尝试:
<%= @team.players %>
我得到如下:
未定义的方法 '玩家' 的#
任何线索可能会发生?