Displaying 1 result from an estimated 1 matches for "create_answer".
2006 Jan 19
8
Passing variables across forms
...;'new''
end
end
def new_answer
# the new answer must belong to a question... so I wasn''t sure
# whether to call it new answer or add answer.
@question = Question.find(params[:id])
@answer = Answer.new
@question.answers << @answer
end
def create_answer
@answer = Answer.new(params[:question_id])
if @answer.save
flash[:notice] = ''Answer was added to the question.''
redirect_to :action => ''show'', :id => @question
else
render :action => ''create_answer''
end...