The table Record has 2 permanent fields: name, email. Besides these 2
fields, for each List a Record can have ‘n’ custom fields.
for example: for list1 I add address(text), dob(date) as custom
fields. then while adding records to list one, each record can have
values for address and dob.
Is there any activerecord plugin which provides this type of
functionality. Else could you share your thoughts on how to model
this.
The table Record has 2 permanent fields: name, email. Besides these 2
fields, for each List a Record can have ‘n’ custom fields.
for example: for list1 I add address(text), dob(date) as custom
fields. then while adding records to list one, each record can have
values for address and dob.
Is there any activerecord plugin which provides this type of
functionality. Else could you share your thoughts on how to model
this.
If there’s really no common schema beyond name and e-mail, then you have
several options to play with:
Use a serialized hash for the “extra” fields.
Put the “extra” fields in some other table and use associations.
Use a schemaless database such as MongoDB.
This is not something that SQL databases do easily.
Put the “extra” fields in some other table and use associations.
You could implement a simple “key - key value” model, and tie that
back to the record and list since it seems that you’ll have different
custom fields per list.
Perhaps the “list” model has an associated list of custom field
definitions (name, type, size, etc?)
Each “record” for the list finds out what its list’s custom fields are,
then maintains values for those in its associated table of ‘custom field
values’
Or something like that…
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.