I am really enjoying the experience of writing my first web app in
Rails. I particularly like the instant feedback the framework offers
when developing in small increments and I am learning new things all the
time. However since I develop alone and my inexperience with rails Iâ??m
asking for help to answer some design questions that I have regarding my
After reading the Agile Rails Dev book I have implemented a shopping
cart system for a fictional holiday property rentals site (may develop
into something more in future) with a few modifications. Instead of
adding line_items it adds available dates for the rental of a particular
property details of which are held in a rentals table which is updated
when as user checks out.
This is fine as long as there is validation against the rentals table
for available dates before adding them to the cart and validation for
duplication of dates already in the cart. The problem is, what happens
when two users add identical properties and dates to their carts at the
same time. If one of them checks out and makes a booking, what happens
to the other user and their cart item? Is it a case of better luck next
time â??you should have checked out quickerâ?, or is it a design and
Would it not be better to test all current sessions for availability of
desired property and dates and then allow users to add chosen dates to
cart if available. The trouble is, is that Iâ??m not sure how to do this
or if it is the right solution at all for this problem.
Any ideas on this issue or where I can find answers to design problems
of this nature are greatly appreciated thanks.