You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To answer briefly here: this is just how the database sorts NULL values. To sort it you'll need to select a real value in place of NULL: format the sort so instead of sort: "revenue" using raw value it uses "COALESCE(revenue, 0)" to replace with 0.
@bnussey this question has been answered before (#443, etc.) In addition to posting on Stack Overflow where a wider community can help you, please search the repository before posting. Thanks!
I have a Ransack
sort_link
on a column calledRevenue
with a default sort:default_order: :desc
The problem I've got at the moment is the items with a null value in Revenue are put to the top. Is there anyway to avoid this?
Here is the full code:
sort_link(@q, :revenue, default_order: :desc)
The text was updated successfully, but these errors were encountered: