fix: Contacts page sort by created_at [CW-2262] (#7584)

Fixes the contacts page sort by created_at.
fixes: #7577
This commit is contained in:
Liam
2023-07-26 16:37:30 +01:00
committed by GitHub
parent 1d8341504a
commit 6c1ee4d965
2 changed files with 9 additions and 0 deletions

View File

@@ -62,6 +62,14 @@ class Contact < ApplicationRecord
)
)
}
scope :order_on_created_at, lambda { |direction|
order(
Arel::Nodes::SqlLiteral.new(
sanitize_sql_for_order("\"contacts\".\"created_at\" #{direction}
NULLS LAST")
)
)
}
scope :order_on_company_name, lambda { |direction|
order(
Arel::Nodes::SqlLiteral.new(