Generally, it shouldn't be the case.
You can check if page is the same by
<%= current_page?(payforms_path) %>
or construct target url by
<%= CGI.unescapeHTML(url_for(payforms_path)) %>
Probably last expression returns '/payforms/submitted' too.
on updated question
You can declare your own validation function, in application_helper.rb for example, and then pass it to link_to_unless
call.
<%= link_to_unless same_page?(payforms_path), "All", payforms_path %>
Some hints on how to implement same_page?
check, see current_page?
in url_helper.rb. Basically, you just need to throw-away parameters check:
# We ignore any extra parameters in the request_uri if the
# submitted url doesn't have any either. This lets the function
# work with things like ?order=asc
if url_string.index("?")
request_uri = request.request_uri
else
request_uri = request.request_uri.split('?').first
end
-->
request_uri = request.request_uri