def new @survey = Survey.find params[:survey_id] @questions = @survey.questions(:include => :answers).map{|q| q.answers.build} respond_to do |format| format.html # new.html.erb format.xml { render :xml => @answer } end end def update @survey.find params[:id] @survey.update_attributes params[:survey] redirect_to wherever end _form.html.haml = form_for @survey do |f| - f.fields_for :questions do |qf| = qf.text_field :question - qf.fields_for :answers do |af| = af.text_field :answer .actions = f.submit