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!, #scoped

Instance Method Details

#createObject



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

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

  save_and_redirect(form_params, :new)
end

#destroyObject



36
37
38
39
40
41
42
# File 'app/controllers/rapidfire/questions_controller.rb', line 36

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

#editObject



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

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

#indexObject



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

def index
  @questions = @survey.questions
end

#newObject



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

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

#updateObject



31
32
33
34
# File 'app/controllers/rapidfire/questions_controller.rb', line 31

def update
  form_params = question_params.merge(:question => @question)
  save_and_redirect(form_params, :edit)
end