# Populating a survey and persisting the user's response

**URL:** <https://www.ruby-forum.com/t/populating-a-survey-and-persisting-the-users-response/120137>\
**Category:** Rails\
**Created:** [November 14, 2007, 1:38am UTC](https://www.ruby-forum.com/t/populating-a-survey-and-persisting-the-users-response/120137 "2007-11-14T01:38:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bob](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ea666f/32.png) [@bob](https://www.ruby-forum.com/u/bob)\
**Post date:** [November 14, 2007, 1:38am UTC](https://www.ruby-forum.com/t/populating-a-survey-and-persisting-the-users-response/120137/1 "2007-11-14T01:38:43Z")

</div>

Let’s say I want to build a survey app that

1. pulls questions and their types out of one table (QUESTIONS)
2. processes these questions into say a 10 question form,
3. user fills in form fully and submits or partly and comes back to it  
later. (RESPONSES)

I -think- I should have one controller (Form) that pulls records from  
both Questions and (If has already started survey) Responses and loop  
through in the view, constructing each formfield and the user’s  
response.

But,

1. Where do I put the logic re use this \_partial for question type 1  
(multiple choice) and this \_partial for type 2 (essay)? The view, the  
controller?
2. How can I save the user’s responses continuously so that if the  
connection is lost, they don’t lose their responses?
