Jack
Jack

Reputation: 3878

Rails: modelling survey responses

I have a question about a project I am working on. The idea is to make a system for storing and completing surveys. I currently have 3 models:

Surveys has many Questions has many Answers

I have created a custom scaffold for creating entries for each of these and the relationships seem logical.

From my perspective that is phase 1 of the project complete, I have created an interface for creating surveys and storing them.

The second part is to make these surveys appear to users so that they can fill them in. What is the best way for me to achieve this? I just need some pointing in the right direction so that I can investigate and take things further.

Thanks

Upvotes: 0

Views: 1544

Answers (2)

Aditya Sanghi
Aditya Sanghi

Reputation: 13433

You could checkout the surveyor gem on github.com

https://github.com/NUBIC/surveyor

It's fairly sophisticated. You may want to play around with the CSS though.

Upvotes: 1

blueblank
blueblank

Reputation: 4904

I recently had to model a near same situation

I have a Survey which has n Questions belonging to the survey.

A Survey has n Responses ( which has the same n Questions through the Survey it belongs to)

I have an Answer model which belongs to a Response and a Question.

So, I can create a survey with questions. To have people fill out the survey I create a response, use the questions from the survey it belongs to, and have answers attached to the question and response, so I can look through everything based on the Survey instance.

Currently modeling various question types, so this only works so far for simple string entry.

btw using DataMapper

Upvotes: 0

Related Questions