It is very simple, yet powerful! It has the pieces missing in all other gems like iterating by multiple columns, multiple directions, iterating over joins or ordering by custom SQL expressions.
Depends on the UUID version. The column to sort by should be sortable. Default (v4) version is not sortable, so you still need to sort by another column.
Currently, the gem implicitly appends a primary column column by default (if it is not explicitly specified), so yeah, that will not work. I think, I will change the gem to not do that for UUIDv4 columns.
The thing I don’t understand is why would we ever want to sort by the primary key column? (Given the fact that it won’t work with UUID primary keys in many cases.)
Why would we not want to (always/by default) sort by .created_at in order to accomplish that goal which seems to be the chronological order?
created_at column values are not unique and when paginating through the records using them, it is possible to skip some records with the same values.
Some people may want to sort by something else, which can also be not unique. So we must append a unique column (the most obvious choice is a primary key) to avoid these problems. So the sorting will be by created_at, id.