I''m writing a "hangman" program that needs to look up sets of words by assorted characteristics (e.g., what letters does the word contain, which dictionaries is the word present in). The simple way to handle this is to create a single table, as: CREATE TABLE words ( id int, length int, -- word length letters int, -- bit map of letter use lists int, -- bit map of word lists word char(50) -- e.g., ''polyglot'' ); SELECT letters, word FROM words WHERE length = 8 AND (letters & 0x123) = 0 AND (lists & 0x12) != 0; Unfortunately, I''m not sure how to use AR to select on a bit map. Is this supported? Also, using a single table is inefficient, because I''ll _always_ be selecting on word length. So, it would make more sense to do something like: CREATE TABLE words_08 ( id int, letters int, -- bit map of letter use lists int, -- bit map of word lists word char(8) -- e.g., ''polyglot'' ); SELECT letters, word FROM words_08 WHERE (letters & 0x123) = 0 AND (lists & 0x12) != 0; However, I''m not at all sure how to do this using AR. I can imagine ways to create classes dynamically and store them in (say) an array, but this seems really baroque. Help? -r -- http://www.cfcl.com/rdm Rich Morin http://www.cfcl.com/rdm/resume rdm-go8te9J4rpw@public.gmane.org http://www.cfcl.com/rdm/weblog +1 650-873-7841 Technical editing and writing, programming, and web development --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---