From 1c6283f8e34b953a1e2481606800b1b07e3f42f0 Mon Sep 17 00:00:00 2001 From: Rueshyna Date: Wed, 5 Dec 2012 18:15:58 +0800 Subject: [PATCH] sort author email --- app/controllers/desktop/co_authors_controller.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/desktop/co_authors_controller.rb b/app/controllers/desktop/co_authors_controller.rb index 91390071..ec2327dd 100644 --- a/app/controllers/desktop/co_authors_controller.rb +++ b/app/controllers/desktop/co_authors_controller.rb @@ -1,6 +1,8 @@ class Desktop::CoAuthorsController < ApplicationController def index - @co_authors = CoAuthor.where(name_id: current_user.id) + @co_authors = CoAuthor.where(name_id: current_user.id).order(["co_author desc"]) + nils, not_nils = @co_authors.partition {|p| p.email.nil? } + @co_authors = not_nils + nils @co_author_relations = CoAuthorRelation.all respond_to do |format|