socialforge/app/models/course.rb

22 lines
649 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.

class Course < ActiveRecord::Base
include Redmine::SafeAttributes
attr_accessible :code, :extra, :name, :state, :tea_id, :time , :location, :state, :term, :password
belongs_to :project, :class_name => 'Project', :foreign_key => :extra # 定义一个project方法 该方法通过extra来调用project表
belongs_to :teacher, :class_name => 'User', :foreign_key => :tea_id # 定义一个方法teacher该方法通过tea_id来调用User表
has_many :bid
validates_presence_of :password, :term
safe_attributes 'extra',
'time',
'name',
'extra',
'code',
'location',
'tea_id',
'password',
'term',
'password'
end