# Nested Form - Not Posting... HELP!?!?!

**URL:** <https://www.ruby-forum.com/t/nested-form-not-posting-help/187994>\
**Category:** Rails\
**Created:** [May 3, 2010, 10:02pm UTC](https://www.ruby-forum.com/t/nested-form-not-posting-help/187994 "2010-05-03T22:02:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![KTKTKT](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/8797f3/32.png) [@KTKTKT](https://www.ruby-forum.com/u/KTKTKT)\
**Post date:** [May 3, 2010, 10:02pm UTC](https://www.ruby-forum.com/t/nested-form-not-posting-help/187994/1 "2010-05-03T22:02:16Z")

</div>

I have a nested form for survey responses, but the form data is not  
being posted to the table; I get no errors, just null values for the  
data from params (‘question\_id’, ‘answer\_id’ and ‘note)’.

Please help!!! And thanks in advance !!

* * *

Model:  
class CreateResponses \< ActiveRecord::Migration  
def self.up  
create\_table :responses do |t|  
t.integer :request\_id  
t.integer :question\_id  
t.integer :answer\_id  
t.text :note  
t.timestamps  
end  
end

* * *

Controller:

def survey\_response  
@request = Request.find(params[:id])  
@survey = Survey.find(:first, :conditions =\> id =  
@request.survey\_id)  
@question = Question.find(:all, :conditions =\> survey\_id =  
@survey.id)  
@resultSet = Array.new  
@question.each do |question|  
answers = Answer.find(:all, :conditions =\> [“question\_id = ?”,  
question.id])  
questionAnswerPair = [question, answers]  
@resultSet \<\< questionAnswerPair  
questionAnswerPair=[]  
answers=[]  
end  
if request.post?  
@response = Response.new(:request\_id =\> @request.id,  
:question\_id =\> (params[:question\_id]),  
:answer\_id =\> (params[:answer\_id]),  
:survey\_id =\> @survey.id,  
:note =\> (params[:note])  
)  
end

end

* * *

survey\_response View:

 \<% @resultSet.each do |questionAnswerPair| %\> \<%= questionAnswerPair[0].content %\>  
 \<%= select("@response", "answer\_id", questionAnswerPair[1].collect {|answer| [answer.content, answer.id]}, :include\_blank =\> true) %\>

 \<% end %\> 

Additional Comments:  
 \<%= f.text\_area :note, :size =\> "60x5" %\>

\<%= f.submit "Submit" %\>

 \<% end %\>
