그룹 모델에는 has_many 기관 및 학교가 있습니다. 그래서 내가 무엇을해야 물론 이것이 가능하지사용자와 그룹에 대한 직접 연결
class Group
has_many :institutions
has_many :users, :through => :instiutions
has_many :schools
has_many :users, :through => :schools
end
class School
belongs_to :group
has_many :educations
has_many :users, :through => :educations
end
class Institution
belongs_to :group
has_many :institutional_educations
has_many :users, :through => :institutional_educations
end
:
class Group
has_many :institutions
has_many :schools
end
그러나 나는 have_and_belongs_to_many 내 그룹이 필요합니다 사용자하지만 난 모든이 같은 기관과 학교를 통해 연결된 사용자를 원한다 해야 할 것?
기관 및 학교 모델을 어떻게 정의합니까? – shingara