使用“当前页面”? 在AJAX之后

I'm using current_page? in my app. My code

Path: groups/@group.id/

<%- if current_page?("/groups/#{task.group.id}/") %>
  <a href="/tasks/<%=task.id%>/undone?idz=1" data-method="patch" data-remote="true">
<%- else %>
  <a href="/tasks/<%=task.id%>/undone?idz=2" data-method="patch" data-remote="true">
<% end %>

It does not work when I render a partial with AJAX. After a PATCH request, the current_page? doesn't recognize the current page.

Normally the good answer is if=true, and after rendering the same partial with AJAX, if becomes true. So I think the partial do not recognize the page anymore

Do you know a solution to solve that?