How to Show Multi Teams Results (Players) in Posts! Ruby On Rails

徘徊边缘 提交于 2019-12-13 01:26:14

问题


How to Show Multi (Teams) Results (Players) in Posts

I Already got one post and both Multi Teams of this post like in this pic!!!

My previous question you can check out is How to use Many to Many Relationship posts#show In ruby on rails. Now I use Teams and Players like this:

In Players#Model

class Player < ActiveRecord::Base
  belongs_to  :team
end

In Teams#Model

class Team < ActiveRecord::Base
  has_many :players

  has_many :postteams
  has_many :posts, :through => :postteams

end

In Postteam#Model

class Postteam < ActiveRecord::Base
  belongs_to :post
  belongs_to :team
end

Now I want to show these Teams Results (Players) with players#Controller in these Teams like this pic example

来源:https://stackoverflow.com/questions/30097589/how-to-show-multi-teams-results-players-in-posts-ruby-on-rails

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!