|
|
@ -21,7 +21,7 @@ class Course < ActiveRecord::Base
|
|
|
|
has_many :homeworks, :through => :homework_for_courses, :source => :bid, :dependent => :destroy
|
|
|
|
has_many :homeworks, :through => :homework_for_courses, :source => :bid, :dependent => :destroy
|
|
|
|
has_many :journals_for_messages, :as => :jour, :dependent => :destroy
|
|
|
|
has_many :journals_for_messages, :as => :jour, :dependent => :destroy
|
|
|
|
has_many :homework_for_courses, :dependent => :destroy
|
|
|
|
has_many :homework_for_courses, :dependent => :destroy
|
|
|
|
has_many :student, :through => :students_for_courses, :source => :user
|
|
|
|
has_many :student, :class_name => 'StudentsForCourse', :source => :user
|
|
|
|
has_many :course_infos, :class_name => 'CourseInfos',:dependent => :destroy
|
|
|
|
has_many :course_infos, :class_name => 'CourseInfos',:dependent => :destroy
|
|
|
|
has_many :enabled_modules, :dependent => :delete_all
|
|
|
|
has_many :enabled_modules, :dependent => :delete_all
|
|
|
|
has_many :boards, :dependent => :destroy, :order => "position ASC"
|
|
|
|
has_many :boards, :dependent => :destroy, :order => "position ASC"
|
|
|
@ -39,7 +39,7 @@ class Course < ActiveRecord::Base
|
|
|
|
validates_format_of :name,:with =>/^[a-zA-Z0-9_\u4e00-\u9fa5]+$/
|
|
|
|
validates_format_of :name,:with =>/^[a-zA-Z0-9_\u4e00-\u9fa5]+$/
|
|
|
|
|
|
|
|
|
|
|
|
before_save :self_validate
|
|
|
|
before_save :self_validate
|
|
|
|
after_save :create_board_sync
|
|
|
|
after_create :create_board_sync
|
|
|
|
before_destroy :delete_all_members
|
|
|
|
before_destroy :delete_all_members
|
|
|
|
|
|
|
|
|
|
|
|
safe_attributes 'extra',
|
|
|
|
safe_attributes 'extra',
|
|
|
|