Discussions
Ordering within many_to_many relationship
over 8 years ago by Jiexi Luan
{% with_scope _slug: "technology" %}
{% assign section = contents.article_sections.first %}
{% endwith_scope%}
{% for subsection in section.subsections %}
.category-block
%h2 {{ subsection.subsection_name }}
.articles
{% for article in subsection.libraryarticles %}
%a.article{:href => '/articles/{{ article._slug }}'}
{% endfor %}
{% endfor %}
{% endblock %}
With two models, subsections and articles.
In locomotive 2.5.7, the order of the articles would be determined by how they were ordered within the subsection.
In locomotive 3.0, the order of the articles is being determined by how they are ordered in the main model page that shows all the articles. Completely ignores the order that they are assigned in the edit page for a subsection.
Subsections and articles are both set to order_by manual. Not that it should matter for subsections.
Is there a way in the model declaration to explicitly say that order in the many_to_many relationship matters? Or is there some magical filter/sort_by that I don't know about?
Thanks!