From: rmmcgr Date: 2005-09-09T09:16:30+09:00 Subject: Rails and Code Tables Hi, I am new to Ruby and the Ruby on Rails framework, and I am in the process of learning both. One question I have about Rails, and ActiveRecord, is: Is there a way to get ActiveRecord to understand the use of a code table? Many of the applications I have developed have a code table that would have a code_type column, a code_value column and a description column. Another table that references a code value, of a particular code type, might have a name like address_type_code. So that in a user interface I can populate a list of options based on the code type (e.g. "ADDRESSTYPES"), and store in address_type_code the corresponding code value selected (e.g. "HOME"). Some tables have multiple columns where they all reference the code table, but for differing code types. My experience with this has been to have one table (the code table) to store many options like this, rather than to have lots of little tables that are for situations such as storing a list of available options. So I guess my question is two fold. Is this a good practise in the first place? And secondly how would I go about getting rails, and ActiveRecord, to work with a code table? Thanks for any advice/help, Regards, Richard