Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix and refactor ordering of template associations
- Removed `.order()` as it was only applied to the main phases query and did not guarantee the order of associated records (e.g., `question_options`), which are loaded in separate queries. - `default_scope { order(number: :asc) }` already exists for the `Phase`, `Section`, and `Question` models, ensuring the desired ordering by default. - The `QuestionOption` model includes `scope :by_number, -> { order(:number) }`, which is now explicitly applied when fetching the `question_options` association to enable proper ordering. - `.order()` must've been auto-including `:id` in the `.select()` clause. Since it is required, we are explicitly adding it now.
- Loading branch information