You might find the arrangement using relationships is actually significantly
simpler to develop, and with a maximum of a few thousand seats (presumably)
you are unlikely to notice any difference in lookup.

The fact that you talk about rows suggests that this is a concept that is
part of your mental image of the problem, it is often best to map your
mental image of the problem into the application, it makes it a better
representation of the real world, which may be much more important than a
few milliseconds of database lookup.

For example, do you wish to keep the number of seats in each row somewhere?
Put it in the rows table.

Colin

2009/5/15 Tom Z Meinlschmidt <[email protected]>

>
> too much complex:)
>
> is good enough to keep only row#nr and seat#nr, eg
>
> table seats contains:
>  id
>  seat_number
>  row_number
>
> is much faster to search/update
>
> tom
>
> Colin Law wrote:
> > Possibly
> > Auditorium has_many Rows
> > Row has_many Seats
> > Seat belongs_to Row
> > Row belongs_to Auditorium
> >
> > Colin
> >
> > 2009/5/15 pb pb <[email protected]
> > <mailto:[email protected]>>
> >
> >
> >     Hey,
> >
> >     Is there any way I can have a model to store an N by N integer
> matrix?
> >     Something that would be able to keep record of rows and seats.
> >
> >     n[i][j] = 1 if the seat is empty
> >     n[i][j] = 2 if the seat is reserved
> >     --
> >     Posted via http://www.ruby-forum.com/.
> >
> >
> >
> >
> > >
>
>
> --
>
> ===============================================================================
> Tomas Meinlschmidt, MS {MCT, MCP+I, MCSE, AER}, NetApp Filer/NetCache
>  - experienced RoR/PHP freelancer, available for hire
>
>   www.meinlschmidt.com  www.maxwellrender.cz  www.lightgems.cz
>
> ===============================================================================
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to