assignment (id, name, date)
activity (id, name, desc)
student (id, name, email)
一个作业可以有很多活动,一个作业可以分配给许多学生。需要跟踪学生的每项活动的状态。
所以有一个三主键表:
assignments_activities_students (assignment_id, activity_id, student_id, status)
在下面设置关联,但它不起作用。有人知道怎么做吗?
assignment
has_many :assignments_activities_students
has_many :students, :through => :assignments_activities_students
has_many :activities, :through => :assignments_activities_students
activity
has_many :assignments_activities_students
has_many :assignments, :through => :assignments_activities_students
has_many :students, :through => :assignments_activities_students
student
has_many :assignments_activities_students
has_many :assignments, :through => :assignments_activities_students
has_many :activities, :through => :assignments_activities_students
assignments_activities_students
belongs_to :assignment
belongs_to :activity
belongs_to :student