Skip to content

Conversation

@gnclmorais
Copy link
Contributor

@gnclmorais gnclmorais commented Dec 19, 2025

Upgrade Pagy gem, following this upgrade guide: https://ddnexus.github.io/pagy/guides/upgrade-guide 🐸

.col-auto
%p.mb-3
!= pagy_info(pagy, item_name: model.pluralize(pagy.count))
!= @pagy.info_tag(item_name: model.pluralize(@pagy.count))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maintenance note: we can pass in a local variable named pagy to this and other partials. That prepares us for Strict Locals in the future.

A nil/missin6 instance variable gives no meaningful error, whereas a missing local variable gives NameError - very clear and actionable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like we’re already doing that, actually:

7 results - 4 files

app/views/admin/feedback/index.html.haml:
   2    - if @feedback.any?
   3:     = render partial: 'shared/pagination', locals: { pagy: @pagy, model: 'feedback' }
   4  

  26  
  27:     = render partial: 'shared/pagination', locals: { pagy: @pagy, model: 'feedback' }
  28  

app/views/admin/members/events.html.haml:
  17          %h3 Past RSVPs
  18:         = render partial: 'shared/pagination', locals: { pagy: @pagy, model: 'events' }
  19  

  22  
  23:         = render partial: 'shared/pagination', locals: { pagy: @pagy, model: 'events' }

app/views/admin/sponsors/index.html.haml:
  15  
  16:   = render partial: 'shared/pagination', locals: { pagy: @pagy, model: 'sponsor' }
  17  

  43  
  44:   = render partial: 'shared/pagination', locals: { pagy: @pagy, model: 'sponsor' }

app/views/coach/_coach.html.haml:
  16  
  17:     = render partial: 'shared/pagination', locals: { pagy: @pagy, model: 'coach' }

# Pagy initializer file (6.2.0)
# Customize only what you really need and notice that the core Pagy works also without any of the following lines.
# Should you just cherry pick part of this file, please maintain the require-order of the extras
# Pagy initializer file (43.2.2) - UPGRADED from 6.2.0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditch the history, it's super without it.

Copy link
Collaborator

@olleolleolle olleolleolle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks super! I only read the code changes, didn't look at the site in preview.

Seems like we are using it in select places only.

The new config experience is lovely.

@gnclmorais
Copy link
Contributor Author

I’ll update the rest either today or tomorrow — thanks @olleolleolle!

Suggestion was “we can pass in a local variable named pagy to this
and other partials. That prepares us for Strict Locals in the future.”
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants