2013-09-12 10:41:15 +08:00
|
|
|
class StudentsForCourse < ActiveRecord::Base
|
|
|
|
attr_accessible :course_id, :student_id
|
|
|
|
|
2014-06-16 17:14:05 +08:00
|
|
|
belongs_to :course, :class_name => 'Course', :foreign_key => :course_id
|
|
|
|
|
2013-09-12 10:41:15 +08:00
|
|
|
belongs_to :student, :class_name => 'User', :foreign_key => :student_id
|
|
|
|
|
|
|
|
validates_presence_of :course_id, :student_id
|
|
|
|
validates_uniqueness_of :student_id, :scope => :course_id
|
|
|
|
|
|
|
|
end
|