views:

82

answers:

0

Hi there,

In a booking engine for buying tickets for events, written in rails, I have the following models:

an order

a ticket

One order has many tickets, and one ticket belongs to an event.

People that want to book tickets for an event, typically create a new order. They fill in some details (kept in the order model), and at the end they see some drop downs where they can select the number of tickets for each ticket type (for example: VIP tickets, student tickets, ...).

a screenshot can be found here:

http://eerlings.com/orders.png

I would like to implement that when the order is created in the DB, for each ticket type, there is a ticket created in the DB, linked to this order. If the attendee selected "5" in the drop down for the VIP tickets, and "3" for the student tickets, there should be 8 tickets created in the DB in total.

What would be the best way to implement this in rails? any suggestions?

Ciao, Pieter