socialforge/app/models/shixun.rb

17 lines
509 B
Ruby
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# status 控制实训的状态0未开启1: 已开启TPM
class Shixun < ActiveRecord::Base
attr_accessible :description, :is_public, :name, :changeset_num, :status, :user_id, :gpid, :language
has_many :users, :through => :shixun_members
has_many :shixun_members
has_one :repository
has_many :challenges, :dependent => :destroy, :order => "challenges.id ASC"
has_many :myshixuns
def owner
User.find(self.user_id)
rescue ActiveRecord::RecordNotFound
render_404
end
end