Class: Taskables::Questions::AnswersController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Taskables::Questions::AnswersController
- Includes:
- Tasuku::Concerns::Redirectable
- Defined in:
- app/controllers/tasuku/taskables/questions/answers_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/controllers/tasuku/taskables/questions/answers_controller.rb', line 9 def create answer = Taskables::Question::Answer.new answer_params[:option_ids].each do |num| answer.votes.build option_id: num end answer. = send Tasks.config. respond_to do |format| if answer.save format.html { redirect_to redirect_path_for(answer) } else format.html { redirect_to :back, alert: answer.errors..to_sentence } end end end |