Merge pull request #1496 from Retrospring/fix/answer-create-render-error

Fix render error on answer create
This commit is contained in:
Karina J. Kwiatek 2023-12-09 18:20:09 +01:00 committed by GitHub
commit 25b5d08889
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -44,9 +44,11 @@ class Ajax::AnswerController < AjaxController
return if inbox
# this assign is needed because shared/_answerbox relies on it, I think
# these assigns are needed because shared/_answerbox rely on them
answer.has_reacted = false
answer.is_subscribed = false
@question = 1
@response[:render] = render_to_string(partial: "answerbox", locals: { a: answer, show_question: false, subscribed_answer_ids: [answer.id] })
@response[:render] = render_to_string(partial: "answerbox", locals: { a: answer, show_question: false })
end
def destroy

View File

@ -1,6 +1,8 @@
class Answer < ApplicationRecord
extend Answer::TimelineMethods
attr_accessor :has_reacted, :is_subscribed
belongs_to :user, counter_cache: :answered_count
belongs_to :question, counter_cache: :answer_count
has_many :comments, dependent: :destroy