Class: Rapidfire::QuestionsController

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

Instance Method Summary collapse

Methods inherited from ApplicationController

#authenticate_administrator!

Instance Method Details

#createObject



19
20
21
22
23
24
25
# File 'app/controllers/rapidfire/questions_controller.rb', line 19

def create
  form_params = params[:question].merge(:question_group => @question_group)
  @question = QuestionForm.new(form_params)
  @question.save

  respond_with(@question, location: index_location)
end

#destroyObject



40
41
42
43
# File 'app/controllers/rapidfire/questions_controller.rb', line 40

def destroy
  @question.destroy
  respond_with(@question, location: index_location)
end

#editObject



27
28
29
30
# File 'app/controllers/rapidfire/questions_controller.rb', line 27

def edit
  @question = QuestionForm.new(:question => @question)
  respond_with(@question)
end

#indexObject



9
10
11
12
# File 'app/controllers/rapidfire/questions_controller.rb', line 9

def index
  @questions = @question_group.questions
  respond_with(@questions)
end

#newObject



14
15
16
17
# File 'app/controllers/rapidfire/questions_controller.rb', line 14

def new
  @question = QuestionForm.new(:question_group => @question_group)
  respond_with(@question)
end

#updateObject



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

def update
  form_params = params[:question].merge(:question => @question)
  @question = QuestionForm.new(form_params)
  @question.save

  respond_with(@question, location: index_location)
end