From fa68ab27d764a36106d6eae3b5c9d4dbd1c58d60 Mon Sep 17 00:00:00 2001 From: Karina Kwiatek Date: Tue, 7 Feb 2023 23:14:33 +0100 Subject: [PATCH] Limit to 10 pinned answers --- app/controllers/user_controller.rb | 1 + app/views/user/show.html.haml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index 17926429..58060d22 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -7,6 +7,7 @@ class UserController < ApplicationController def show @answers = @user.cursored_answers(last_id: params[:last_id]) + @pinned_answers = @user.answers.pinned.limit(10) @answers_last_id = @answers.map(&:id).min @more_data_available = !@user.cursored_answers(last_id: @answers_last_id, size: 1).count.zero? diff --git a/app/views/user/show.html.haml b/app/views/user/show.html.haml index 4456aa90..25240a33 100644 --- a/app/views/user/show.html.haml +++ b/app/views/user/show.html.haml @@ -1,6 +1,6 @@ - unless @user.banned? #pinned-answers - - @user.answers.pinned.each do |a| + - @pinned_answers.each do |a| = render "answerbox", a: #answers