[Ruby] refactoring/drying help

Fred Loney fred.loney at gmail.com
Fri Oct 12 08:58:56 PDT 2007


Since each person can be assigned to more than one role, you will need
an association table.

Also, consider splitting the name during migration into first, last,
middle, where middle is anything in between first and last. This
format eliminates redundancy and allows sort and select by last name.

Thus:

people
- id
- first_name
- last_name
- middle_name

roles
- id
- name

person_roles
- person_id
- role_id

The association table also makes it easier to add information about
the person in the role, e.g. experience or publications.

Some post-migration data-scrubbing might be in order, e.g. to fix
records with one name component that is inappropriately assigned to
first rather than last.

-- 
Fred Loney
Spirited Software
www.spiritedsw.com


More information about the Ruby mailing list