Method: SurveyorController#edit

Defined in:
app/controllers/surveyor_controller.rb

#editObject



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'app/controllers/surveyor_controller.rb', line 50

def edit
  @response_set = ResponseSet.find_by_access_code(params[:response_set_code], :include => {:responses => [:question, :answer]})
  if @response_set
    @survey = Survey.with_sections.find_by_id(@response_set.survey_id)
    @sections = @survey.sections
    if params[:section]  
      @section = @sections.with_includes.find(section_id_from(params[:section])) || @sections.with_includes.first 
    else
      @section = @sections.with_includes.first
    end
    @questions = @section.questions
    @dependents = (@response_set.unanswered_dependencies - @section.questions) || []
  else
    flash[:notice] = "Unable to find your responses to the survey"
    redirect_to(available_surveys_path)
  end
end