修复邀请码会变的问题

This commit is contained in:
guange 2016-06-28 17:46:27 +08:00
parent 436de8ce5a
commit 3c425edc3c
1 changed files with 1 additions and 0 deletions

View File

@ -470,6 +470,7 @@ class Course < ActiveRecord::Base
if !code || code.size <5
code = CODES.sample(5).join
return generate_invite_code if Course.where(invite_code: code).present?
self[:invite_code] = code
save! && reload
end
code