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



16
17
18
19
20
# File 'app/controllers/rapidfire/questions_controller.rb', line 16

def create
  form_params = question_params.merge(:survey => @survey)

  save_and_redirect(form_params, :new)
end

#destroyObject



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

def destroy
  @question.destroy
  respond_to do |format|
    format.html { redirect_to index_location }
    format.js
  end
end

#editObject



22
23
24
# File 'app/controllers/rapidfire/questions_controller.rb', line 22

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

#indexObject



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

def index
  @questions = @survey.questions
end

#newObject



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

def new
  @question_form = QuestionForm.new(:survey => @survey)
end

#updateObject



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

def update
  form_params = question_params.merge(:question => @question)

  save_and_redirect(form_params, :edit)
end