archive module: fix old data caused error
This commit is contained in:
parent
5b7ac1a22b
commit
a468b69013
|
@ -23,7 +23,7 @@ module Mongoid
|
|||
def set_sort_number
|
||||
if self.new? && self.sort_number.nil?
|
||||
last_record = self.class.desc(:sort_number).first
|
||||
if last_record
|
||||
if last_record.sort_number
|
||||
self.sort_number = (last_record.sort_number + 10) / 10 * 10
|
||||
else
|
||||
self.sort_number = 10
|
||||
|
|
Loading…
Reference in New Issue