From 4016070f2caf30f576d0b0df8a65a7b4b468e951 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Mon, 12 May 2025 14:07:23 -0400 Subject: Paginate stream updates --- app/controllers/streams_controller.rb | 1 + app/views/streams/_stream.html.haml | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/controllers/streams_controller.rb b/app/controllers/streams_controller.rb index 664f533..9b7588c 100644 --- a/app/controllers/streams_controller.rb +++ b/app/controllers/streams_controller.rb @@ -2,6 +2,7 @@ class StreamsController < ApplicationController def show @stream = Stream.find_by_slug(params[:slug]) + @updates = @stream.updates.paginate(page: params[:page], per_page: 10) end end diff --git a/app/views/streams/_stream.html.haml b/app/views/streams/_stream.html.haml index 74e8a19..4a6b1e9 100644 --- a/app/views/streams/_stream.html.haml +++ b/app/views/streams/_stream.html.haml @@ -2,5 +2,9 @@ %h2#stream-title= stream.title - unless stream.body.blank? %header#stream-intro.entry-content= markdown(stream.body) - - unless stream.updates.empty? - = render stream.updates + - if stream.updates.size > 10 + = will_paginate @updates + - unless @updates.empty? + = render @updates + - if stream.updates.size > 10 + = will_paginate @updates -- cgit 1.4.1