archive module: fix old data caused error

This commit is contained in:
iCross 2013-06-06 23:10:42 +08:00
parent 5b7ac1a22b
commit a468b69013
1 changed files with 1 additions and 1 deletions

View File

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