You know how some bug trackers (and other software) allow you to add custom fields?
Typically this is done with a data structure that looks something like this:
Items
----------
ID | NAME | ITEM_TYPE_ID
FieldDefinitions
---------------------------------------
ID | ITEM_TYPE_ID | FIELD_NAME | FIELD_TYPE
FieldValues
---------------------------------------
ID | FIELD_ID | ITEM_ID | VALUE
I'm trying to figure out the best way to approach this design in Rails. There will be many models which I want to allow extending simple properties.
When I retreive an Item
I'd like it to include a hash of the addition field values that have been defined for that model.