diff --git a/app/models/archive_file.rb b/app/models/archive_file.rb index ee2542b..eb19fc5 100644 --- a/app/models/archive_file.rb +++ b/app/models/archive_file.rb @@ -18,7 +18,7 @@ class ArchiveFile before_save do cat = self.category rescue nil if cat && ArchiveCategory.where(:category_id => cat.id).count==0 - ArchiveCategory.create(category_id: cat.id.to_s) + ArchiveCategory.create(category_id: cat.id.to_s,sort_number: cat.sort_number) end end @@ -109,10 +109,10 @@ class ArchiveFile end def save_archive_file_multiples - self.archive_file_multiples.each do |t| - if t.should_destroy - t.destroy - end + self.archive_file_multiples.each do |t| + if t.should_destroy + t.destroy + end end end