In my view, I want to use link_to_unless_current create a link to “/payforms” when I’m on page. However, when I pass parameters, such as, “/payforms?submitted=true”, for example, the function still thinks I’m on “current” and the link is not created. Is there a way for me to check if there are no parameters?
<%= link_to_unless_current "All", payforms_path %>
Maybe something like this?
<%= link_to_unless_current "All", payforms_path(:params => nil)
Generally, it shouldn’t be the case.
You can check if page is the same by
or construct target url by
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_unlesscall.Some hints on how to implement
same_page?check, seecurrent_page?in url_helper.rb. Basically, you just need to throw-away parameters check:–>