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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:18:19+00:00 2026-06-11T05:18:19+00:00

What is the best practice for this situation? I am building a reservation system,

  • 0

What is the best practice for this situation?

I am building a reservation system, and I’m looking at the best way to capture and store information from a user. Each resource is available for one day and can take any amount of users up to the maximum. So for example, say it’s a hot air balloon with a maximum of 5 people. I want my form to look like this:

[Buttons to select # of guests]  // So if a user wants the same price for 1-3 people he only has to enter it once.

From [START DATE] to [END DATE]: [RATE]  // Where the []'s are input fields for the user

I plan to store each price in the database as:

Date, # of guests, rate

So one row for each date.

So I need to convert “[START DATE] to [END DATE]” to storing the values for each date. Should I do that client side in Javascript, or in my controller in rails? If the rates are the same for a set of guests, i.e. 1-3 guests, is there a way I can store that in the DB for better querying? Or should I not bother because if tomorrow the user wants to change the price for 2 guests, it might screw up my db.

  • 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-11T05:18:21+00:00Added an answer on June 11, 2026 at 5:18 am

    Start date and End date vs. Each date – several conditions:

    1. If the user wants to book a hot air balloon for 3 days, is it the same hot air balloon every day or can it change? If it can be different, have a resources.type field mapped to several booked_resources.id.

    2. You need to check for overlaps of resource usage if you use separate start and end dates. Storing repeated records one-per-date with the booked_resource.id would remove the need for overlap checks. See this thread for a related question: Storing Calendar Data in MySQL

    3. Sending the client-side JS an array of dates for each day can be more easy than extracting for each day between start date and end date. Pick whichever conforms best to your current code. Remember that either way, the SQL/date checking has to be modified to spot for unavailability.

    4. If a user can change the number of guests and that affects cost, then storing each individual date is more convenient for db updates of that kind (like the itemized billng by Hotels). Otherwise you would need to ‘split’ records for the dates which have different # of guests.

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

Sidebar

Related Questions

Which is the best practice in this situation? I would like an un-initialized array
Can someone guide me on the best practice for this situation; I have a
What is the general best practice for this type of functionality. I have a
I formerly asked for a Best-Practice regarding this, But this is one the strategies
What's the best practice to do this? Basically I am using rabbitMQ and it
My question is that is this the best practice to do this. Couldn't find
This is a beginner-best-practice question in perl. I'm new to this language. The question
This is a security best practice and I'm wondering if I should even be
I know this isn't best practice, but can I include all of the dependencies
This is a 'best practice' question. I want to play with the look and

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.