hi i''m trying to create a web app in rails which would allow an administrator to setup a custom survey and allow users to fill-in the survey. Sounds simple enough but how do you create a datastore (presumably in mySQL) when you don''t know the type of each question? So you could have 3 multiple choice questions then 1 text box followed by a date chooser. My thoughts are: a) use generic types - such as text or blob and limit the number of questions b) generate the answers table upon completion of the the survey structure - this then can''t be edited (but unlikely to need editing cause you can''t change a survey after it''s started anyway or you wouldn''t have a complete set of results). I hope this is a generic enough question that the discussion will be relevant to more than myself :) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
thanks - that was quick. it''s funny just writing the question down helped point me in the right direction. Your solution seems to be what I suspected but you''ve elaborated and made it much clearer - particularly hadn''t thought of pages, thanks. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
> i''m trying to create a web app in rails which would allow an > administrator to setup a custom survey and allow users to fill-in the > survey. Sounds simple enough but how do you create a datastore > (presumably in mySQL) when you don''t know the type of each question? So > you could have 3 multiple choice questions then 1 text box followed by > a date chooser. > > My thoughts are: > a) use generic types - such as text or blob and limit the number of > questions > b) generate the answers table upon completion of the the survey > structure - this then can''t be edited (but unlikely to need editing > cause you can''t change a survey after it''s started anyway or you > wouldn''t have a complete set of results).Think of all the various types of questions you might have... - true/false - multiple choice (pick one) - multiple choice (pick any) - free form (ie. text) - rating (1-5, etc. which is really just multiple choice, I guess) Then build a schema to hold all of those. Then build a schema to hold the concept of a survey, which would consist of the name of the survey, who''s running it, etc. along with "links" to each of the questions built and what order to display them in. Also consider having "pages" within a survey that the questions might belong to. -philip --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Philip, is your suggestion to create a single model that will accommodate any of these response types, or to create a distinct model for each response type? I am designing a similar system and am curious about your thoughts. Thanks. Paul Davis Philip Hallstrom wrote:>> b) generate the answers table upon completion of the the survey >> structure - this then can''t be edited (but unlikely to need editing >> cause you can''t change a survey after it''s started anyway or you >> wouldn''t have a complete set of results). > > Think of all the various types of questions you might have... > > - true/false > - multiple choice (pick one) > - multiple choice (pick any) > - free form (ie. text) > - rating (1-5, etc. which is really just multiple choice, I guess) > > Then build a schema to hold all of those. Then build a schema to hold > the > concept of a survey, which would consist of the name of the survey, > who''s > running it, etc. along with "links" to each of the questions built and > what order to display them in. Also consider having "pages" within a > survey that the questions might belong to. > > -philip-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
> Philip, is your suggestion to create a single model that will > accommodate any of these response types, or to create a distinct model > for each response type? I am designing a similar system and am curious > about your thoughts.Honestly I hadn''t thought about it that far :) THere are probably pros and cons to each I suppose... Some things could be made simpler if you could use STI I suppose... certainly they could share the survey_id, page_num, etc... fields.> > Thanks. > > Paul Davis > > Philip Hallstrom wrote: >>> b) generate the answers table upon completion of the the survey >>> structure - this then can''t be edited (but unlikely to need editing >>> cause you can''t change a survey after it''s started anyway or you >>> wouldn''t have a complete set of results). >> >> Think of all the various types of questions you might have... >> >> - true/false >> - multiple choice (pick one) >> - multiple choice (pick any) >> - free form (ie. text) >> - rating (1-5, etc. which is really just multiple choice, I guess) >> >> Then build a schema to hold all of those. Then build a schema to hold >> the >> concept of a survey, which would consist of the name of the survey, >> who''s >> running it, etc. along with "links" to each of the questions built and >> what order to display them in. Also consider having "pages" within a >> survey that the questions might belong to. >> >> -philip > > > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
creativetags wrote:> hi > > i''m trying to create a web app in rails which would allow an > administrator to setup a custom survey and allow users to fill-in the > survey.I did this a couple of years ago. My co-worker thought it was a little over-engineered, but my model was something like the following. Handles multiple choice (radio or checkbox), true/false (just one example of multiple choice), fill-in-the-blank, multiple-row questions, etc. Survey title description >> surveySections SurveySection >> surveys title description position >> questions Question > surveySection questionText position >> questionRows > questionOptionSet QuestionRow > question rowText position isFillIn QuestionOptionSet >> questionOptions minSelections maxSelections QuestionOption optionText integerValue (for data collection, such as averaging responses) position > questionOptionSet SurveyResponse > survey > questionRow >> selectedQuestionOptions fillInValue Something like that. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---