From 066bf32e0caa74204884315cd0cc79ecea7253a8 Mon Sep 17 00:00:00 2001 From: Hugo Peixoto Date: Sun, 24 Sep 2023 11:28:58 +0100 Subject: [PATCH] Fix sorting in members/index --- app/helpers/members_helper.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/helpers/members_helper.rb b/app/helpers/members_helper.rb index eaf9de3..5735d7a 100644 --- a/app/helpers/members_helper.rb +++ b/app/helpers/members_helper.rb @@ -2,14 +2,15 @@ module MembersHelper def link_to_current_with_sort text, default_sort current_sort = stringify(sort_params) - pp [default_sort, current_sort] + current_params = request.params.except(:action, :controller) if default_sort == current_sort - link_to text, members_path(sort: invert_sort_order(current_sort)) + current_params.merge!(sort: invert_sort_order(current_sort)) else - link_to text, members_path(sort: default_sort) + current_params.merge!(sort: default_sort) end + link_to text, members_path(current_params) end private