Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Set "order" of related models

Is there any way to specify the order of related models?

I'm looping through related models of a model in my Volt template, and I want the related models to be sorted alphabetically. Using:

{% for User in LoopDeparment.getUsers(['order'=>'name']) %}

causes an "unexpected ASSIGN" error.



85.4k
Accepted
answer

It must be:

{% for User in LoopDeparment.getUsers(['order': 'name']) %}

Ah. Yep - that works. Thanks.