forked from leikind/wice_grid
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Only call group when there actually is a group set in WiceGrid#read relation This fixes a bug with wrong paginated result set when having a wice_grid with an include or column with assoc option on a many association. If this is the case the grid tries to eager load this association (due to the include/references on the relation). Rails then normally gets the correct page set by performing an additonal query to get the matching IDs without the eager load, however this functionality is disabled when there is a group set on the relation. Because WiceGrid always called group even when there was no group set this behaviour was always disabled, leading to an incorrect page set. By only calling group when there actually is a group we fix this problem in most cases. However, when providing a group to the grid, problems still occur, but so does providing a group to a relation with eager load in PostgreSQL in Rails itself already (e.g. `Author.eager_load(:books).group(:id)`). It might be better to never eager load associations, but instead always preload them and add the sort/filter conditions using a left_joins (in combination with a distinct to get each main model only once). Also return Arel in get_custom_order_reference when custom order is SqlLiteral Fixes 'Query method called with non-attribute argument(s)' when using Arel.sql for custom order in combination with Ruby 3. Should already have been fixed when the deprecation warning was fixed, but apparently it was not. Fixup c7a9da2 fix for issue leikind#82
- Loading branch information
Showing
5 changed files
with
6 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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