|
|
|
@ -6,7 +6,8 @@ class AnswersController < ApplicationController |
|
|
|
def create |
|
|
|
not_found unless question |
|
|
|
|
|
|
|
@answer = Answer.new(answer_params.merge(player_id: current_player.id, node_id: question.id)) |
|
|
|
@answer = Answer.find_or_initialize_by(player_id: current_player.id, node_id: question.id) |
|
|
|
@answer.update(answer_params) |
|
|
|
|
|
|
|
respond_to do |format| |
|
|
|
if @answer.save |
|
|
|
@ -19,6 +20,10 @@ class AnswersController < ApplicationController |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def update |
|
|
|
create |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
private |
|
|
|
|
|
|
|
|