增加《不区分大小写分班班名唯一》功能
Signed-off-by: alan <547533434@qq.com>
This commit is contained in:
parent
90a01c8d84
commit
66d76eeed7
|
@ -12,7 +12,8 @@ class CourseGroup < ActiveRecord::Base
|
|||
before_destroy :set_member_nil
|
||||
|
||||
attr_accessible :name
|
||||
validates :name, :presence => true, :length => {:maximum => 20}, :uniqueness => true
|
||||
validates :name, :presence => true, :length => {:maximum => 20},
|
||||
:uniqueness => {case_sensitive: false}
|
||||
def set_member_nil
|
||||
if self.members && self.members.count > 0
|
||||
self.members.update_all("course_group_id = 0")
|
||||
|
|
Loading…
Reference in New Issue