summaryrefslogtreecommitdiffstats
path: root/app/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/documents_controller.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/app/controllers/documents_controller.rb b/app/controllers/documents_controller.rb
index e458d838a..fbd2b4136 100644
--- a/app/controllers/documents_controller.rb
+++ b/app/controllers/documents_controller.rb
@@ -33,7 +33,8 @@ class DocumentsController < ApplicationController
documents = @project.documents.includes(:attachments, :category).to_a
case @sort_by
when 'date'
- @grouped = documents.group_by {|d| d.updated_on.to_date }
+ documents.sort!{|a,b| b.updated_on <=> a.updated_on}
+ @grouped = documents.group_by {|d| d.updated_on.to_date}
when 'title'
@grouped = documents.group_by {|d| d.title.first.upcase}
when 'author'