나는 사용자 모델을 보유하고 있으며 (교사, 학생 및 원칙) STI학생, 교사, 기간 및 참석자 간의 관계
을 사용하여 모든 클래스에는 많은 학생과 교사가 있습니다. 모든 학생마다 많은 수업이 있습니다. 모든 클래스는 많은 학생들에게 모든 클래스는 많은 기간이
class Class < ApplicationRecord
has_and_belongs_to_many:students
belongs_to:teacher
has_many:periods
end
class User < ApplicationRecord
has_and_belongs_to_many:students
belongs_to:teacher
has_many:periods
end
class Teacher < User
has_many:classes
end
class Student < User
has_and_belongs_to_many:classes
has_many:period
end
class Period < ApplicationRecord
belongs_to:teacher
belongs_to:student
end
있습니다.
매 학기마다 각 학생마다 출석이 있기 때문에 수업에 출석을 어떻게 설정할 수 있습니까? 나는 어떻게 사용자와 수업 및 출석과 출석 사이의 관계를 만드나요?
class Attendance < ApplicationRecord
????????
end
질문을 다시 포맷해야합니다. 그것은 당신이 원하는 것을 완전히 명확하지 않습니다. – meshpi