Class: Rapidfire::AttemptsController

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

Instance Method Summary collapse

Methods inherited from ApplicationController

#authenticate_administrator!, #rapidfire_scoped

Instance Method Details

#createObject



13
14
15
16
17
18
19
20
21
# File 'app/controllers/rapidfire/attempts_controller.rb', line 13

def create
  @attempt_builder = AttemptBuilder.new(attempt_params)

  if @attempt_builder.save
    redirect_to after_answer_path_for
  else
    render :new
  end
end

#editObject



23
24
25
# File 'app/controllers/rapidfire/attempts_controller.rb', line 23

def edit
  @attempt_builder = AttemptBuilder.new(attempt_params)
end

#newObject



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

def new
  @attempt_builder = AttemptBuilder.new(attempt_params)
end

#showObject



5
6
7
# File 'app/controllers/rapidfire/attempts_controller.rb', line 5

def show
  @attempt = @survey.attempts.find_by(attempt_params_for_find)
end

#updateObject



27
28
29
30
31
32
33
34
35
# File 'app/controllers/rapidfire/attempts_controller.rb', line 27

def update
  @attempt_builder = AttemptBuilder.new(attempt_params)

  if @attempt_builder.save
    redirect_to after_answer_path_for
  else
    render :edit
  end
end