Fix bug.
This commit is contained in:
parent
113a40d51d
commit
3f3c966597
|
@ -13,7 +13,7 @@ class TableEntry
|
|||
|
||||
before_save do
|
||||
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
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue