socialforge/app/models/challenge.rb

14 lines
372 B
Ruby

class Challenge < ActiveRecord::Base
belongs_to :shixun,:touch=> true
belongs_to :user
has_many :shixun_comments
has_many :challenge_samples, :dependent => :destroy
has_many :test_sets, :dependent => :destroy
validates_presence_of :subject
validates_presence_of :score
validates_presence_of :task_pass
validates_length_of :subject, :maximum => 255
end