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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T12:33:16+00:00 2026-06-08T12:33:16+00:00

I have a controller (with RoR, but let’s assume I have some server listening

  • 0

I have a controller (with RoR, but let’s assume I have some server listening for a request) that deals with the search of hotels. The default search is by city, so given a city, the controller will look for all the hotels in that city.

Once that view is rendered, I have a form that lets you filter the results. My question is:

How am I supposed to save the current state of the user preferences (filters and city) in order to send them to the controller action again?

So, let’s say that the user clicks on sort by price, and via AJAX I want to fetch the hotels for a given city (chosen before) ordered by price. How do I know which city he has chosen before? Do I need to store it in a hidden field or what’s the appropriate way of doing so?

Same question rises if after filtering the order by price, the user selects the luxury hotels option. I need to fetch hotels by a given city, ordered by price and with category of luxury. Where am I supposed to store the prior states of the search?

Thanks

  • 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-08T12:33:19+00:00Added an answer on June 8, 2026 at 12:33 pm

    You could store the prior states simply in a JavaScript variable or a hidden form field. Either is fine, and the right choice will depend more on your code design than on any kind of functionality/performance issue. And if you can’t figure out which way is better for your particular case, don’t worry about it because it probably just doesn’t matter.

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

Sidebar

Related Questions

I'm fairly new to RoR I have a controller and within that controller I
I have created a search action for an existing entity(model/controller/view) in RoR and the
I'm new with RoR and I have a controller ( UsersController ) where I
I have a big problem (even my server's admin seems to have some difficulties
Hi this is ROR beginner's question. I have creat controller.rb and view hello.rhtml following
Have Controller: public class MyController : Controller { [HttpGet] public ActionResult MyAction(int iMode, string
I have Controller A and controller B is pushed on top of it in
I have controller and model. i am modifying a variable value in a model,
I have controller users . In this controller I have action account which is
I have controller with action new , and I want it to create ActiveRecord::Base

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.