This commit is contained in:
BoHung Chiu 2022-04-01 16:06:59 +08:00
parent 113a40d51d
commit 3f3c966597
1 changed files with 1 additions and 1 deletions

View File

@ -13,7 +13,7 @@ class TableEntry
before_save do before_save do
if self[:sort_number].nil? if self[:sort_number].nil?
sort_number_to_set = self.class.where(u_table_id: self.u_table_id).order_by(sort_number: :desc).first.sort_number sort_number_to_set = self.class.where(u_table_id: self.u_table_id).order_by(sort_number: :desc).first.sort_number rescue 0
self.sort_number = sort_number_to_set + 1 self.sort_number = sort_number_to_set + 1
end end
end end