Properly format native SQL in Principals.ordered_by_name scope

This commit is contained in:
Klaus Zanders
2026-04-22 12:19:36 +02:00
parent 7fd0cf36a9
commit 472e0143aa
@@ -41,7 +41,7 @@ module Principals::Scopes
def ordered_by_name(desc: false)
direction = desc ? "DESC" : "ASC"
order_case = Arel.sql <<~SQL
order_case = Arel.sql(<<~SQL.squish)
CASE
WHEN users.type = 'User' THEN LOWER(#{user_concat_sql})
WHEN users.type != 'User' THEN LOWER(users.lastname)