From e0d20e4e873e91b56c4c284e5b54d8695d78f3a8 Mon Sep 17 00:00:00 2001 From: Manny Dinssa <44172848+Dinssa@users.noreply.github.com> Date: Wed, 14 Aug 2024 16:21:39 +0100 Subject: [PATCH] Change SQL query --- app/controllers/organisations_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/organisations_controller.rb b/app/controllers/organisations_controller.rb index fd3350442..ead33fbc6 100644 --- a/app/controllers/organisations_controller.rb +++ b/app/controllers/organisations_controller.rb @@ -18,7 +18,7 @@ class OrganisationsController < ApplicationController @pagy, @organisations = pagy(filtered_collection(all_organisations.visible, search_term)) @merge_requests = MergeRequest.visible .joins("LEFT JOIN organisations ON organisations.id = merge_requests.absorbing_organisation_id") - .order(Arel.sql("organisations.name, merge_requests.merge_date IS NULL, merge_requests.merge_date DESC, merge_requests.id")) + .order("organisations.name, merge_requests.merge_date DESC NULLS LAST, merge_requests.id") @searched = search_term.presence @total_count = all_organisations.visible.size end