更改项目文档按作者排序

This commit is contained in:
nwb 2014-07-22 13:47:05 +08:00
parent 09f13409de
commit 42c2f6c2ee
2 changed files with 3 additions and 2 deletions

View File

@ -42,7 +42,8 @@ class DocumentsController < ApplicationController
when 'title'
@grouped = documents.group_by {|d| d.title.first.upcase}
when 'author'
@grouped = documents.select{|d| d.attachments.any?}.group_by {|d| d.attachments.last.author}
# @grouped = documents.select{|d| d.attachments.any?}.group_by {|d| d.attachments.last.author}
@grouped = documents.group_by {|d| d.user.name }
else
@grouped = documents.group_by(&:category)
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20140721074353) do
ActiveRecord::Schema.define(:version => 20140722024513) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false