Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 888903
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T13:28:46+00:00 2026-05-15T13:28:46+00:00

In my view, I want to use link_to_unless_current create a link to /payforms when

  • 0

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)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T13:28:47+00:00Added an answer on May 15, 2026 at 1:28 pm

    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
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create a view that consists solely of a UITextView . When
I want to create a view that has different displays according to the role
I want to include a link in my SiteMaster (using Html.ActionLink) UNLESS the view
I have a view that I want to add some custom drawing to. I
Using Eclipse I want to view the source code for a core Java class
In my code, I want to view all data from a CSV in table
When I type git diff , I want to view the output with my
I want to be able to view a SQL Server 2005 Reporting Services report
I want to write a custom view engine that returns custom text (like coma
I want to have a abstract view for any type of UI (web or

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.