class ContestantForContest < ActiveRecord::Base belongs_to :contest attr_accessible :student_id, :contest_id belongs_to :contestants, :class_name => 'User', :foreign_key => :student_id validates_presence_of :contest_id, :student_id validates_uniqueness_of :student_id, :scope => :contest_id end