Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@jarenas9539
Copy link

@jarenas9539 jarenas9539 commented Feb 4, 2024

Main Purpose

Adding a paginated? helper to PageScopeMethods and AR extensions.

Context

Lately I found myself implementing a See All option in a few pages. As expected I had to find a way to conditionally render paginate section leading to conditions on views as relation.respond_to?(:total_pages) or relation.limit_value.present?.
That was the moment when the paginated? helper came to my mind, a simple and clean method to achieve this check.

Changes

  • adding paginated? with default value false to AR relations to have it available even if pagination method wasn't called
  • defining paginated? on PageScopeMethods relying on limit_value (this way we ensure the helper being true just when the pagination method is called and include support to possible unscope calls too)
  • added tests ✅
  • updated README

On a separated note: contributions section on README should be updated, current lines described there to run specs are relying on removed gemfiles/*

@yuki24
Copy link
Member

yuki24 commented Feb 5, 2024

Looks good to me 👍

@amatsuda What do you think of this change?

@jarenas9539 jarenas9539 force-pushed the feature/adding-paginated-helper-to-active-record-extensions branch from 2631f8e to 9374827 Compare March 3, 2025 06:17
@jarenas9539 jarenas9539 force-pushed the feature/adding-paginated-helper-to-active-record-extensions branch from 9374827 to 0f671b2 Compare March 3, 2025 06:19
@jarenas9539
Copy link
Author

Just checking in — any extra thoughts on this PR? Happy to adjust or clarify anything needed.

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