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

  • Home
  • SEARCH
  • 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 9233017
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:27:07+00:00 2026-06-18T06:27:07+00:00

I have a website with a form for location on the front page. I

  • 0

I have a website with a form for location on the front page. I want to auto-populate the form with values based on a URL string. How can I do this in rails?

For example, I would like the form to show with the value New York when the user arrives on the front page based on something like: website.com?city=”New York”

How best to implement this in rails?

  • 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-06-18T06:27:08+00:00Added an answer on June 18, 2026 at 6:27 am

    First of all, you can get the current request url, everything is here : How do I get the current absolute URL in Ruby on Rails?

    Then you just have to “parse” it :

    <% city = request.fullpath.split('=').last %>
    

    Will return “New York” with a url like website.com?city="New York"
    (Not sure about this one but maybe you can get it only with params[:city], I just don’t think params is available in a view)

    The rest depends on the structure of your form…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this website (C#/ASP.NET) with a form where the user can register for
I have an php website with login form and I want every visitors can
I have this contact form on my website, but I can't make it to
I have a website form that collects url of users to store in a
I have website based on Umbraco 5. I have installed contact form plugin (http://cultivjupitercontact.codeplex.com/).
I have a website that updates the users location through the use of form
On my website I have a page that can only be viewed if the
My URL is http://www.website.ro/index.php?subiect=10046&pag=1 #1006 , and i have a form here with no
I have an asp.net website and a windows form application. My Webservice's Location is
We have a form on our website in which a user can fill out

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.