added sorting for archives

This commit is contained in:
Harry Bomrah 2015-10-15 14:59:08 +08:00
parent fd29da19e5
commit e4bf9f829c
1 changed files with 3 additions and 1 deletions

View File

@ -34,12 +34,14 @@ class ArchivesController < ApplicationController
{ {
"archive-title" => archive.title, "archive-title" => archive.title,
"statuses" => statuses, "statuses" => statuses,
"sort_number" => archive.sort_number,
"files" => files "files" => files
} }
end end
sorted = archives.sort_by{|k,v| k["sort_number"].to_i}
{ {
"category-title" => category.title, "category-title" => category.title,
"archives" => archives, "archives" => sorted,
"url_to_edit" => url_to_edit "url_to_edit" => url_to_edit
} }
end end