Keep the current filter params after deleting a saved filter so you can change your mind
This commit is contained in:
@@ -7,12 +7,13 @@ class FiltersController < ApplicationController
|
||||
end
|
||||
|
||||
def destroy
|
||||
filter_params = @filter.as_params
|
||||
@filter.destroy!
|
||||
|
||||
if request.referer == root_url
|
||||
redirect_to root_path
|
||||
else
|
||||
redirect_to cards_path
|
||||
redirect_to cards_path(filter_params)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -25,9 +25,12 @@ class FiltersControllerTest < ActionDispatch::IntegrationTest
|
||||
end
|
||||
|
||||
test "destroy" do
|
||||
filter = filters(:jz_assignments)
|
||||
expected_params = filter.as_params
|
||||
|
||||
assert_difference "users(:david).filters.count", -1 do
|
||||
delete filter_path(filters(:jz_assignments))
|
||||
delete filter_path(filter)
|
||||
end
|
||||
assert_redirected_to cards_path
|
||||
assert_redirected_to cards_path(expected_params)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user