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

Return ordered results for belongs_to array #390

Merged
merged 2 commits into from
Sep 14, 2021
Merged

Conversation

jaredcwhite
Copy link
Member

Summary

Previously, if you had an array of resource relations using belong_to, the result set would not be ordered in the same way as your front matter. Now you get exactly the results you specify. For example:

pages: ["posts", "404", "about", "404", "posts"]

calling resource.relations.pages will literally retrieve an array of resources in that order (posts, 404, about, 404, posts).

Context

Resolves #360

@render
Copy link

render bot commented Sep 12, 2021

@render
Copy link

render bot commented Sep 12, 2021

@render
Copy link

render bot commented Sep 12, 2021

@jaredcwhite jaredcwhite merged commit a593e9b into main Sep 14, 2021
@jaredcwhite jaredcwhite deleted the ordered-belongs-to branch September 14, 2021 14:46
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.

feat: Preserve order of related records in relations
1 participant