9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'app/controllers/tasuku/taskables/questions/answers_controller.rb', line 9
def create
return redirect_to :back, alert: I18n.t('tasuku.taskables.questions.answers.no_answers') unless params[:taskables_question_answer]
answer = Taskables::Question::Answer.new
answer_params[:option_ids].each do |num|
answer.votes.build option_id: num
end
answer.author = send Tasks.config.author
respond_to do |format|
if answer.save
format.html { redirect_to redirect_path_for(answer) }
else
format.html { redirect_to :back, alert: answer.errors.full_messages.to_sentence }
end
end
end
|