[Bug Fix] Fix DataTable pagination with array params and adapter naming#359
Merged
djalmaaraujo merged 4 commits intomainfrom Apr 29, 2026
Merged
[Bug Fix] Fix DataTable pagination with array params and adapter naming#359djalmaaraujo merged 4 commits intomainfrom
djalmaaraujo merged 4 commits intomainfrom
Conversation
Array#to_s returns inspect output (e.g. '["uuid"]'), which Rails re-parses as a literal string inside the array. Use Array(v) to handle both scalar and array values correctly.
Rename DataTablePaginationAdapters::{Pagy,Kaminari,Manual} to
DataTable{Pagy,Kaminari,Manual}Adapter under RubyUI namespace.
Fixes class name collision when host app includes RubyUI module
(e.g. Pagy clashing with the pagy gem). Also fixes generator
only copying data_table/ folder, missing the separate adapters dir.
Add prev_label and next_label params (default "<" and ">"). Skip rendering when total pages <= 1.
pierry01
reviewed
Apr 29, 2026
Comment on lines
+4
to
+6
| require_relative "data_table_manual_adapter" | ||
| require_relative "data_table_pagy_adapter" | ||
| require_relative "data_table_kaminari_adapter" |
Contributor
There was a problem hiding this comment.
@djalmaaraujo I believe it's not necessary anymore.
Contributor
Author
There was a problem hiding this comment.
The gem doesn't use Zeitwerk, so require_relative is needed here. When the generator copies the files into a Rails app, the app's autoloader handles it — but in the gem context these are required.
pierry01
reviewed
Apr 29, 2026
| if current <= 1 | ||
| li do | ||
| span(class: "opacity-50 pointer-events-none px-3 h-9 inline-flex items-center text-sm") { plain "Previous" } | ||
| span(class: "opacity-50 pointer-events-none px-3 h-9 inline-flex items-center text-sm") { plain @prev_label } |
Contributor
There was a problem hiding this comment.
One line plain is unnecessary.
span(class: "...") { @prev_label } # it works
cirdes
approved these changes
Apr 29, 2026
Phlex renders ivars directly in tag blocks without plain.
djalmaaraujo
pushed a commit
that referenced
this pull request
Apr 30, 2026
Bumps [tailwindcss](https://github.com/tailwindlabs/tailwindcss/tree/HEAD/packages/tailwindcss) from 4.1.14 to 4.1.17. - [Release notes](https://github.com/tailwindlabs/tailwindcss/releases) - [Changelog](https://github.com/tailwindlabs/tailwindcss/blob/main/CHANGELOG.md) - [Commits](https://github.com/tailwindlabs/tailwindcss/commits/v4.1.17/packages/tailwindcss) --- updated-dependencies: - dependency-name: tailwindcss dependency-version: 4.1.17 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix
build_querylosing array param values: When query params contain arrays (e.g. combobox filters),Array#to_swas producing inspect output like["uuid"]instead of proper query string encoding. Replaced withArray(v)to handle both scalar and array values correctly using only stdlib (CGI.escape).Move pagination adapters into
data_table/folder: RenamedDataTablePaginationAdapters::{Pagy,Kaminari,Manual}toDataTable{Pagy,Kaminari,Manual}Adapterdirectly underRubyUInamespace. This fixes two issues:RubyUImodule (e.g.Pagyclashing with the pagy gem)ruby_ui:component DataTable) only copies thedata_table/folder, so adapters in a separatedata_table_pagination_adapters/directory were missing from the generated outputCustomizable prev/next labels: Added
prev_label:andnext_label:params (default"<"and">") instead of hardcoded English stringsHide pagination for single page: Skip rendering when
total_pages <= 1Test plan
data_table/ids=uuid-1&ids=uuid-2)include RubyUI