Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set an implicit order on models #1293

Merged
merged 2 commits into from
Mar 21, 2024

Conversation

mec
Copy link
Contributor

@mec mec commented Mar 21, 2024

As we use uuids as primary keys the order of objects can be unexpected
without an explicit sort order.

By setting the implicit_order_column to created_at we get back the
expected behaviour of sequential primary keys.

https://api.rubyonrails.org/classes/ActiveRecord/ModelSchema.html#method-c-implicit_order_column

This work resolves #1242

As we use uuids as primary keys the order of objects can be unexpected
without an explicit sort order.

By setting the `implicit_order_column` to `created_at` we get back the
expected behaviour of sequential primary keys.

https://api.rubyonrails.org/classes/ActiveRecord/ModelSchema.html#method-c-implicit_order_column
@mec mec force-pushed the add-implicit-sort-order-to-models branch from eb7a8eb to 501da1c Compare March 21, 2024 08:26
@bensheldon bensheldon added the refactor Code changes that do not introduce new features label Mar 21, 2024
Copy link
Owner

@bensheldon bensheldon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mec Thank you!!! This is sooo nice 🥇

@bensheldon bensheldon merged commit 14950d7 into bensheldon:main Mar 21, 2024
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Code changes that do not introduce new features
Projects
Development

Successfully merging this pull request may close these issues.

Set an implicit order on models
2 participants