Fix bulk destroy redirect

This commit is contained in:
Eugene Burmakin 2024-09-28 16:50:49 +02:00
parent 4d743ae314
commit 6f2486b8ec

View file

@ -20,7 +20,7 @@ class PointsController < ApplicationController
def bulk_destroy
current_user.tracked_points.where(id: params[:point_ids].compact).destroy_all
redirect_to points_url(params.slice(:start_at, :end_at, :order_by, :import_id)),
redirect_to points_url(preserved_params),
notice: 'Points were successfully destroyed.',
status: :see_other
end
@ -58,4 +58,8 @@ class PointsController < ApplicationController
def order_by
params[:order_by] || 'desc'
end
def preserved_params
params.to_enum.to_h.with_indifferent_access.slice(:start_at, :end_at, :order_by, :import_id)
end
end