I am working on dynamic form generator. Someone can create fields like: string, text, boolean, number, file etc.
Are there any gems or guidelines for storing data from such dynamic forms?
I mean I can create a number of tables for each datatype, or I can store all of them as a TEXT with flag wich type it should be converted.
UPD
or I’d better use nosql here?
I believe Mongodb is a right choice for this application, since it doesn’t enforce any schema, its a good choice for arbitrary data.
As well, it does support all the datatype you have expected. so it is easy.
Have a form collection which looks like this (Ruby Mongoid code)
and
To add value field as a dynamic field, you need to enable
allow_dynamic_fields: truein mongoid.ymland create a new field like this
Hope this helps