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 3321998
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T23:07:48+00:00 2026-05-17T23:07:48+00:00

I have a single text box form on my home page (/). Right now

  • 0

I have a single text box form on my home page (/).

Right now the way my Rails routes is set up, when I submit this form, it takes me to /search, but it doesn’t publish the query string in my url.

In other words, when I enter in “hello” in that form and press submit, I want to end up at “/search?query=hello”. I know that “hello” is in params[:query], but how do I get Rails to publish that query string in the landing page URL after I submit the query?

I read the Rails routes guide but that talks about incoming query strings in the URL, not Rails publishing the URL with the query string visible.

Thanks.

My form tag so far:

<% form_tag(:controller => "search", :action => "search", :method => :get) do %>
              <%= text_field_tag 'query' %>
              <%= submit_tag "Search"%>

            <% end %>

If I do this, I get /search?method=get, but what I would like to see is /search?query=foo.

  • 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-17T23:07:49+00:00Added an answer on May 17, 2026 at 11:07 pm

    You just need define a form with get method instead of post

    <% form_tag search_url, :method => :get do %>
    
        <%=text_field_tag :search %>
        <%= submit_tag %>
    
    <% end %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form with a single text box on it. No other controls.
I have a text box like this <TextBox x:Name=SA1 Grid.Row=1 Grid.Column=1 TextAlignment=Center/> I need
I have a php form with some text box, list of radio buttons and
I have an Ajax form with a single input and a button. On submit,
I have a page with a single form on it. The form contains a
I have a page with several Ajax.InPlaceEditor fields. Some are single line (text input
I have a single line CEikLabel in my application that needs to scroll text.
I have a sproc that returns a single line and column with a text,
I have a single Rails 2.2.2 app that I want to 'share' with multiple
I have a rails form that has a datetime input. I'd like to make

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.