Does Pagy::Keyset support AR relations ordered with SQL string expressions? #740
-
Consider the following example: relation = User.order("LOWER(users.name) ASC").order(:id)
keyset = Pagy::Keyset.new(relation) This raises the following error: (irb):54:in `<main>': undefined method `value' for an instance of String (NoMethodError)
keyset[node.value.name.to_sym] = node.direction |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 9 replies
-
Not out of the box ATM A simple (for us) way of doing it, would require a new feature that we should be able to add easily, and your custom query, run inside an Another way would be supporting it natively, but it would probably complicate the code quite a bit. |
Beta Was this translation helpful? Give feedback.
-
Would love support for this as well. The data I want to use Pagy::Keyset to paginate over contains ambiguous |
Beta Was this translation helpful? Give feedback.
Not out of the box ATM
A simple (for us) way of doing it, would require a new feature that we should be able to add easily, and your custom query, run inside an
:after_latest
lambda.Another way would be supporting it natively, but it would probably complicate the code quite a bit.