Skip to content

Sort by has_many relationship causes wrong query #1097

@CV-Gate

Description

@CV-Gate

As an example:

/api/indicators?sort=widgets.title

results in this query:

SELECT "indicators".* FROM "indicators" LEFT JOIN widgets AS widgets_sorting ON widgets_sorting.id = indicators.indicator_id ORDER BY widgets_sorting.title asc

As you can see, it should be indicators.id and not indicators.indicators_id

This doesn't happen if sort is done by a has_one relation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions