I’m trying to move to rails from traditional web app.
As Rails has some conventions about table schema,
I met some obstacles.
This is a sort of general question. Do you make a code table for things
like the following?
Activity Status Codes
(The first 2 digits are code category.)
Would you make a code table for these codes or would you input the
description directly into the column?
If the codes are flexible (editable by users), the answer must be “use
But what if the codes are fixed?
When you need to have a code table, would you still use codes like
‘01001’ or just use a sequential id or both (id is primary key and code
is non-primary key)?
Columns: id, description
Columns: id, category_id, description
I guess that I’d better use id instead of codes like ‘01001’.
But for some extreme case, it’s not easy to determine.
For example, zip code table?
You don’t want to make sequential ids for zip codes, right?
I want to hear about your opinions and advices.