Is there a way to sort the items in a has-many-association? I have one model A that has many of B (fields: a, b, sort) and in B there is a variable to sort the items (sort). Is there a way to associate A.ID and B.a and get a list of B.b sorted by B.sort?

The document you expected this should be explained

https://gorm.io/docs/has_many.html

Expected answer

I currently solved this with an AfterFind.Hook but I hope there is a better (performing) solution

Comment From: github-actions[bot]

This issue has been automatically marked as stale because it has been open 360 days with no activity. Remove stale label or comment or this will be closed in 180 days

Comment From: saeidee

You may try https://gorm.io/docs/preload.html#Custom-Preloading-SQL.