On Sun, Oct 12, 2014 at 6:54 PM, Colin Law <clan...@gmail.com> wrote:
> The first point is that you should only add rows as seats are booked,
> use that fact that there is no row to indicate that there is no
> booking.

> Secondly, what is the date?  Is that the date of the journey or the
> date of the booking?  I don't understand why you have multiplied the
> number of trains by 20 days.  If it is the date of the journey then
> consider having a Journeys table which is a particular train on a
> particular day.

It's the date of the journey. I once thought about this method, the
problem is I don't know how to  implement it in rails. In Rails
tutorials and guidelines, there is a model file in app/model directory
for every table. If I need to create new journey tables, what's the
model files and migration files look like?(Or I don't need them any
more?)

> Thirdly I don't understand why you have 20 factorial for the city
> combinations.  Is it not true that if a seat is booked from station 1
> to station 3 then that implies a booking 1 to 2 and 2 to 3?   In which
> case you do not separate rows for bookings 1 to 2, 2 to 3, and 1 to 3.

According to your first and third point, It's because my design is
different. In my design one booking might indicates more than one row.
A row just means the state of a seat. So, if a seat is booked from
station 1 to station 3, then rows representing 1->3, 1->2, 2->3, 1->4,
1->5.... all need to change. I do it in this way because I have
another table representing the number of left seats, and I think it's
easier to update this table in my way(in this case, the number of leaf
seats from 1->3, 1->2, 2->3.... decreases by one).

Thank you for your suggestion! I'll dig it deeper and reveal my concerns.

-- 
Best Regards

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CALDAArpqTg%2B9ot_bTLAB8jyse7JW9wT%3DMCaN0gArogHgKUB6yg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to