我可以这样做吗?
Class School < ActiveRecord::Base
has_many :courses
has_many :students, :through => courses, :through => coursesections, :through => enrollments
end
Class Course < ActiveRecord::Base
has_many :coursesections
has_one :school
end
Class CourseSection < ActiveRecord::Base
has_one :course
has_one :school, :through => courses
has_many :students, :through => enrollments
end
Class Student < ActiveRecord::Base
has_many :sections, :through => enrollments
end
注册表只有一个student_id和一个学生注册的课程部分的section_id。