Storing multiple choices in databases

As an example - you have a select list of all the U.S. states and the
user
can make multiple choices.
How do you grab all those choices into the database and they would be
used
for queries.
I was reading up on serialize() but the warning in AWDWR is that it
doesn’t
work well for queries. Also composites / aggragates seems a bit much,
maybe
not.

I know in the past I’ve used addtional tables as example.

Tavels_table - id, user_id States_table - id, travel_id, state
id,
travel_id,
state
id,
travel_id,
state

So if the user chose 3 states - each of the the 3 travel_id’s above (in
the
States_table) would be the same and correspond to the id in the
Travels_table.
Almost makes you never want to offer multiple choice selects :).

TIA
Stuart


Sorry, I know this might be off topic , more database design then Rails,
but
I’d like to know if there are ways in Rails to make this easier.

On 10/5/06, Dark A. [email protected] wrote:

TIA
Stuart


http://en.wikipedia.org/wiki/Dark_ambient


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs