2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
# File 'app/controllers/surveyor_gui/survey_controller.rb', line 2
def show
@title = "User Will See this Survey"
@survey = Survey.find(params[:survey_id])
user_id = defined?(current_user) && current_user ? current_user.id : 1
ResponseSet.where('survey_id = ? and test_data = ? and user_id = ?',params[:survey_id],true, user_id).each {|r| r.destroy}
@response_set = ResponseSet.create(:survey => @survey, :user_id => user_id, :test_data => true)
if (@survey)
flash[:notice] = t('surveyor.survey_started_success')
redirect_to surveyor.edit_my_survey_path @survey.access_code, @response_set.access_code
else
flash[:notice] = "Survey not found."
redirect :back
end
end
|