-
-
Save anveo/639702 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment