Skip to content

Conversation

@pedropb
Copy link
Contributor

@pedropb pedropb commented May 29, 2024

Reverts #456

#456 introduced a bug in the following code path:

@base_relation = relation.reorder(@columns.join(","))

when relation.reorder(*<array_of_arels>) is invoked, implicitly a to_s is called on each Arel, which expands them to "table.column" and ActiveRecord prepends table again, leading to a clause like:

 ORDER BY `products`.`products.created_at`, products`.`products.id`

instead of:

 ORDER BY products.created_at, products.id

which was the previous behaviour.

@pedropb pedropb force-pushed the revert-456-pb-use-arel-for-conditions branch from ec26e56 to f43ed29 Compare May 29, 2024 22:58
@pedropb pedropb marked this pull request as ready for review May 29, 2024 22:58
@pedropb pedropb requested review from Mangara and ehasrouni May 29, 2024 22:58
@pedropb pedropb force-pushed the revert-456-pb-use-arel-for-conditions branch 2 times, most recently from e0f775b to 6287d30 Compare May 29, 2024 22:59
@pedropb pedropb force-pushed the revert-456-pb-use-arel-for-conditions branch from 6287d30 to 6aa24b2 Compare May 29, 2024 23:00
@pedropb pedropb merged commit 10787b9 into main May 29, 2024
@pedropb pedropb deleted the revert-456-pb-use-arel-for-conditions branch May 29, 2024 23:37
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