fix small error in user model

need to use the parent's generation to calculate generation!
This commit is contained in:
Devin Howard 2015-12-07 11:44:08 +08:00
parent 3b89a2a13f
commit b037c84f15

View file

@ -78,7 +78,7 @@ class User < ActiveRecord::Base
if code == joinedwithcode
update(generation: 0)
else
update(generation: User.find_by_code(joinedwithcode) + 1)
update(generation: User.find_by_code(joinedwithcode).generation + 1)
end
end