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

Instance Method Details

#createObject



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

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

  save_and_redirect(form_params, :new)
end

#destroyObject



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

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

#editObject



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

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

#indexObject



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

def index
  @questions = @survey.questions
end

#newObject



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

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

#updateObject



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

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