@ -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