socialforge/app/models/contestant_for_contest.rb

9 lines
306 B
Ruby
Raw Normal View History

2016-12-22 10:01:37 +08:00
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
2016-12-22 17:13:10 +08:00
validates_uniqueness_of :student_id, :scope => :contest_id
2016-12-22 10:01:37 +08:00
end