越过course表的validate,以防save invitecode 失败
This commit is contained in:
parent
7fdfc02821
commit
222855ea79
6
Gemfile
6
Gemfile
|
@ -3,7 +3,11 @@ source 'https://ruby.taobao.org/'
|
|||
unless RUBY_PLATFORM =~ /w32/
|
||||
# unix-like only
|
||||
gem 'iconv'
|
||||
gem "rmagick", "= 2.13.1" ## centos yum install ImageMagick-devel
|
||||
if RUBY_PLATFORM =~ /darwin/
|
||||
gem "rmagick", "= 2.15.4" ## osx must be this version
|
||||
else
|
||||
gem "rmagick", "= 2.13.1" ## centos yum install ImageMagick-devel
|
||||
end
|
||||
gem 'certified'
|
||||
end
|
||||
|
||||
|
|
|
@ -470,8 +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
|
||||
update_attribute(:invite_code, code)
|
||||
end
|
||||
code
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue