Merge pull request #1496 from Retrospring/fix/answer-create-render-error
Fix render error on answer create
This commit is contained in:
commit
25b5d08889
|
@ -44,9 +44,11 @@ class Ajax::AnswerController < AjaxController
|
||||||
|
|
||||||
return if inbox
|
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
|
@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
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
class Answer < ApplicationRecord
|
class Answer < ApplicationRecord
|
||||||
extend Answer::TimelineMethods
|
extend Answer::TimelineMethods
|
||||||
|
|
||||||
|
attr_accessor :has_reacted, :is_subscribed
|
||||||
|
|
||||||
belongs_to :user, counter_cache: :answered_count
|
belongs_to :user, counter_cache: :answered_count
|
||||||
belongs_to :question, counter_cache: :answer_count
|
belongs_to :question, counter_cache: :answer_count
|
||||||
has_many :comments, dependent: :destroy
|
has_many :comments, dependent: :destroy
|
||||||
|
|
Loading…
Reference in New Issue