ruby on rails - ActiveRecord model with variable number and order of fields as relations -


i trying create application similar functionality google forms, user can determine template of different question types , collect multiple responses per template. in specific, need create forms have user-determined number (and order) of free response (paragraph text field) , picture upload questions.

how set scheme in activerecord? thinking of having formresponse model store each response, has_many models of type questionresponse response each question, textresponse , uploadresponse models single table inheritance classes of questionresponse. there more elegant method of storing such structure using activerecord? how should store template, structure of questions, in such schema? better off using flexible document model of mongo , embedding question response documents inside list inside form response document?

one of common concepts think results , questionnaire separately , store aggregated results each respondent in single record. might use json data type if using postgres. alternatively single mongo document might work.


Comments