From 5384116f11862a017ebe1083d0597c6a7d83ebbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20=C5=A0vara?= Date: Thu, 22 Jan 2026 16:44:30 +0100 Subject: [PATCH] Rename the helper to user_pins and extract a pins_limit method. --- app/controllers/my/pins_controller.rb | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/app/controllers/my/pins_controller.rb b/app/controllers/my/pins_controller.rb index 70e40ce98..18b58910f 100644 --- a/app/controllers/my/pins_controller.rb +++ b/app/controllers/my/pins_controller.rb @@ -1,17 +1,15 @@ class My::PinsController < ApplicationController def index - @pins = pins_for_request + @pins = user_pins fresh_when etag: [ @pins, @pins.collect(&:card) ] end private - def pins_for_request - pins = Current.user.pins.includes(:card).ordered + def user_pins + Current.user.pins.includes(:card).ordered.limit(pins_limit) + end - if request.format.json? - pins.limit(100) - else - pins.limit(20) - end + def pins_limit + request.format.json? ? 100 : 20 end end