课程名称有效性判断

This commit is contained in:
nwb 2014-06-27 11:42:45 +08:00
parent c0f0e294e5
commit ad97066a45
1 changed files with 2 additions and 1 deletions

View File

@ -33,8 +33,9 @@ class Course < ActiveRecord::Base
acts_as_attachable :view_permission => :view_files,
:delete_permission => :manage_files
validates_presence_of :password, :term
validates_presence_of :password, :term,:name
validates_format_of :class_period, :with =>/^[1-9]\d*$/
validates_format_of :name,:with =>/^[a-zA-Z0-9_\u4e00-\u9fa5]+$/
after_save :create_board_sync
before_destroy :delete_all_members