From 6724aef105baff5f2e824b7c0eac458b8f907753 Mon Sep 17 00:00:00 2001 From: Karina Kwiatek Date: Fri, 10 Feb 2023 22:23:34 +0100 Subject: [PATCH] Order pinned answers by when they were pinned --- app/controllers/user_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index 58060d22..1963b496 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -7,7 +7,7 @@ class UserController < ApplicationController def show @answers = @user.cursored_answers(last_id: params[:last_id]) - @pinned_answers = @user.answers.pinned.limit(10) + @pinned_answers = @user.answers.pinned.order(pinned_at: :desc).limit(10) @answers_last_id = @answers.map(&:id).min @more_data_available = !@user.cursored_answers(last_id: @answers_last_id, size: 1).count.zero?