diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2013-02-17 11:10:17 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2013-02-17 11:10:17 +0000 |
commit | c17ec1643c005036870b45c7b496bbbb3a9784be (patch) | |
tree | d9a195a5ad11249a25ee8d41e26ba611313e57e4 /app/controllers/boards_controller.rb | |
parent | dbf1fed6fbd5d572688c92fd014b96ec21864c63 (diff) | |
download | redmine-c17ec1643c005036870b45c7b496bbbb3a9784be.tar.gz redmine-c17ec1643c005036870b45c7b496bbbb3a9784be.zip |
Fixed that messages are not sorted by last reply (#12243).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11424 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/boards_controller.rb')
-rw-r--r-- | app/controllers/boards_controller.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/app/controllers/boards_controller.rb b/app/controllers/boards_controller.rb index ae0110875..2ecbc63eb 100644 --- a/app/controllers/boards_controller.rb +++ b/app/controllers/boards_controller.rb @@ -39,16 +39,17 @@ class BoardsController < ApplicationController sort_init 'updated_on', 'desc' sort_update 'created_on' => "#{Message.table_name}.created_on", 'replies' => "#{Message.table_name}.replies_count", - 'updated_on' => "#{Message.table_name}.updated_on" + 'updated_on' => "COALESCE(last_replies_messages.created_on, #{Message.table_name}.created_on)" @topic_count = @board.topics.count @topic_pages = Paginator.new @topic_count, per_page_option, params['page'] @topics = @board.topics. reorder("#{Message.table_name}.sticky DESC"). - includes(:author, {:last_reply => :author}). + includes(:last_reply). limit(@topic_pages.items_per_page). offset(@topic_pages.offset). order(sort_clause). + preload(:author, {:last_reply => :author}). all @message = Message.new(:board => @board) render :action => 'show', :layout => !request.xhr? |