Class: Rapidfire::QuestionsController
Instance Method Summary
collapse
#authenticate_administrator!
Instance Method Details
#create ⇒ Object
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
|
#destroy ⇒ Object
40
41
42
43
|
# File 'app/controllers/rapidfire/questions_controller.rb', line 40
def destroy
@question.destroy
respond_with(@question, location: index_location)
end
|
#edit ⇒ Object
27
28
29
30
|
# File 'app/controllers/rapidfire/questions_controller.rb', line 27
def edit
@question = QuestionForm.new(:question => @question)
respond_with(@question)
end
|
#index ⇒ Object
9
10
11
12
|
# File 'app/controllers/rapidfire/questions_controller.rb', line 9
def index
@questions = @question_group.questions
respond_with(@questions)
end
|
#new ⇒ Object
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
|
#update ⇒ Object
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
|