Class: Rapidfire::QuestionGroupsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/rapidfire/question_groups_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#authenticate_administrator!

Instance Method Details

#createObject



17
18
19
20
21
22
# File 'app/controllers/rapidfire/question_groups_controller.rb', line 17

def create
  @question_group = QuestionGroup.new(question_group_params)
  @question_group.save

  respond_with(@question_group, location: rapidfire.question_groups_url)
end

#destroyObject



24
25
26
27
28
29
# File 'app/controllers/rapidfire/question_groups_controller.rb', line 24

def destroy
  @question_group = QuestionGroup.find(params[:id])
  @question_group.destroy

  respond_with(@question_group)
end

#indexObject



7
8
9
10
# File 'app/controllers/rapidfire/question_groups_controller.rb', line 7

def index
  @question_groups = QuestionGroup.all
  respond_with(@question_groups)
end

#newObject



12
13
14
15
# File 'app/controllers/rapidfire/question_groups_controller.rb', line 12

def new
  @question_group = QuestionGroup.new
  respond_with(@question_group)
end

#resultsObject



31
32
33
34
35
36
37
# File 'app/controllers/rapidfire/question_groups_controller.rb', line 31

def results
  @question_group = QuestionGroup.find(params[:id])
  @question_group_results =
    QuestionGroupResults.new(question_group: @question_group).extract

  respond_with(@question_group_results, root: false)
end