Skip to content
Snippets Groups Projects
Commit ba6f9ab6 authored by ArtOfCode-'s avatar ArtOfCode-
Browse files

Always update question last_activity on answer

parent ead971b0
No related merge requests found
......@@ -20,9 +20,12 @@ class AnswersController < ApplicationController
body: AnswersController.renderer.render(params[:answer][:body_markdown]),
last_activity: DateTime.now, last_activity_by: current_user,
category: @question.category))
unless current_user.id == @question.user.id
@question.user.create_notification("New answer to your question '#{@question.title.truncate(50)}'",
share_question_url(@question))
end
if @answer.save
@question.update(last_activity: DateTime.now, last_activity_by: current_user)
redirect_to url_for(controller: :questions, action: :show, id: params[:id])
else
render :new, status: 422
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment