Class: Rapidfire::SurveysController
Instance Method Summary
collapse
#authenticate_administrator!
Instance Method Details
#create ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'app/controllers/rapidfire/surveys_controller.rb', line 13
def create
@survey = Survey.new(survey_params)
if @survey.save
respond_to do |format|
format.html { redirect_to surveys_path }
format.js
end
else
respond_to do |format|
format.html { render :new }
format.js
end
end
end
|
#destroy ⇒ Object
28
29
30
31
32
33
34
35
36
|
# File 'app/controllers/rapidfire/surveys_controller.rb', line 28
def destroy
@survey = Survey.find(params[:id])
@survey.destroy
respond_to do |format|
format.html { redirect_to surveys_path }
format.js
end
end
|
#index ⇒ Object
5
6
7
|
# File 'app/controllers/rapidfire/surveys_controller.rb', line 5
def index
@surveys = Survey.all
end
|
#new ⇒ Object
9
10
11
|
# File 'app/controllers/rapidfire/surveys_controller.rb', line 9
def new
@survey = Survey.new
end
|
#results ⇒ Object
38
39
40
41
42
43
44
45
46
47
48
|
# File 'app/controllers/rapidfire/surveys_controller.rb', line 38
def results
@survey = Survey.find(params[:id])
@survey_results =
SurveyResults.new(survey: @survey).
respond_to do |format|
format.json { render json: @survey_results, root: false }
format.html
format.js
end
end
|