bigdir/app/models/join_in_competition.rb

11 lines
356 B
Ruby

# 新竞赛参加关系表
class JoinInCompetition < ActiveRecord::Base
attr_accessible :competition_id, :user_id
belongs_to :user, :class_name => "User", :foreign_key => :user_id
belongs_to :competition, :class_name => "Contest", :foreign_key => :competition_id
validates :user_id, presence: true
validates :competition_id, presence: true
end