From 29613bee90a3beee61596b04d12ab7005c9d69f1 Mon Sep 17 00:00:00 2001 From: an-lee Date: Wed, 19 Nov 2025 15:17:55 +0800 Subject: [PATCH 1/2] Upgrade Pagy to version 43 BREAKING CHANGE: Upgrade from Pagy 9.3.1 to 43.0.6 This upgrade implements the breaking changes required by Pagy 43, which is a complete redesign of the legacy code. The changes include: - Replace Pagy::Backend with Pagy::Method in EventsController * The backend module has been renamed to Method in v43 - Remove Pagy::Frontend include from ApplicationHelper * Frontend functionality is now integrated into the core and no longer requires explicit inclusion - Update pagy_nav helper to use new instance method syntax * Changed from pagy_nav(@pagy) to @pagy.series_nav * This follows the new pattern where helpers are now instance methods on the @pagy object - Update gemspec to require Pagy >= 43.0.6 * Updated minimum version requirement to support the new API All changes follow the official Pagy 43 upgrade guide: https://ddnexus.github.io/pagy/guides/upgrade-guide/ Refs: https://ddnexus.github.io/pagy/guides/upgrade-guide/ --- app/controllers/inner_performance/events_controller.rb | 2 +- app/helpers/inner_performance/application_helper.rb | 2 -- app/views/inner_performance/events/index.html.erb | 2 +- inner_performance.gemspec | 2 +- 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/app/controllers/inner_performance/events_controller.rb b/app/controllers/inner_performance/events_controller.rb index a6cc88c..a6098a1 100644 --- a/app/controllers/inner_performance/events_controller.rb +++ b/app/controllers/inner_performance/events_controller.rb @@ -2,7 +2,7 @@ module InnerPerformance class EventsController < ApplicationController - include Pagy::Backend + include Pagy::Method def index @q = InnerPerformance::Event.all.ransack(params[:q]) diff --git a/app/helpers/inner_performance/application_helper.rb b/app/helpers/inner_performance/application_helper.rb index 54d30ee..222b488 100644 --- a/app/helpers/inner_performance/application_helper.rb +++ b/app/helpers/inner_performance/application_helper.rb @@ -2,8 +2,6 @@ module InnerPerformance module ApplicationHelper - include Pagy::Frontend - # Based on https://stackoverflow.com/a/45428183/552936 and # https://datadome.co/learning-center/how-to-reduce-server-response-time/ def row_class_from_duration(duration) diff --git a/app/views/inner_performance/events/index.html.erb b/app/views/inner_performance/events/index.html.erb index dec7c76..8d8dd33 100644 --- a/app/views/inner_performance/events/index.html.erb +++ b/app/views/inner_performance/events/index.html.erb @@ -36,4 +36,4 @@ -<%== pagy_nav(@pagy) if @pagy.pages > 1 %> +<%== @pagy.series_nav if @pagy.pages > 1 %> diff --git a/inner_performance.gemspec b/inner_performance.gemspec index 0ba61da..85b595b 100644 --- a/inner_performance.gemspec +++ b/inner_performance.gemspec @@ -23,7 +23,7 @@ Gem::Specification.new do |spec| end spec.add_dependency("activejob", ">= 7.1.5") - spec.add_dependency("pagy", ">= 9.3.1") + spec.add_dependency("pagy", ">= 43.0.6") spec.add_dependency("rails", ">= 7.1.5") spec.add_dependency("ransack", ">= 4.2.1") From dded211172a15b0109d778bf97b8402d5af3e715 Mon Sep 17 00:00:00 2001 From: an-lee Date: Mon, 1 Dec 2025 11:17:54 +0800 Subject: [PATCH 2/2] bump requried ruby version >= 3.2 --- .github/workflows/build.yml | 2 +- inner_performance.gemspec | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0b12087..297b948 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -118,7 +118,7 @@ jobs: - uses: ruby/setup-ruby@v1 with: - ruby-version: 3.1 + ruby-version: 3.2 bundler-cache: true - name: Rubocop diff --git a/inner_performance.gemspec b/inner_performance.gemspec index 85b595b..b6f57b5 100644 --- a/inner_performance.gemspec +++ b/inner_performance.gemspec @@ -18,6 +18,8 @@ Gem::Specification.new do |spec| spec.metadata["source_code_uri"] = "https://github.com/mbajur/inner_performance" spec.metadata["changelog_uri"] = "https://github.com/mbajur/inner_performance" + spec.required_ruby_version = ">= 3.2" + spec.files = Dir.chdir(File.expand_path(__dir__)) do Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.md"] end