I’m working on a contact management app and 3 of the requirements are:
- the user should be able to add additional custom Contact fields
(e.g. an extra phone number that isnt provided in the std set of
- the user should be able to name fields with whatever label they want
(e.g. one user might label with “Vacation Phone”, another as “Home
- the custom data will be typed and grouped so that we know that it’s
text data vs a phone number (for example) and so that we can get the
list of all custom phone numbers or addresses
I’m more concerned with the first req right now regarding storage and
the best way to then access and use this data, but am glad to hear
thoughts on the others as well.
My thought is to have a column in the DB called “custom” that’s a text
field and then either go with a YAML style or XML for storing the
field label and data.
But, what’s the best way to encapsulate and do things in the model
code to make these attributes accessible from the rest of the app in a
way thatis transparent to those other parts of the app?