if a question was answered, all occurrences of it in the inbox are now gone
This commit is contained in:
parent
72140be316
commit
aec3e1c800
|
@ -5,6 +5,8 @@ class Answer < ActiveRecord::Base
|
||||||
has_many :smiles, dependent: :destroy
|
has_many :smiles, dependent: :destroy
|
||||||
|
|
||||||
after_create do
|
after_create do
|
||||||
|
Inbox.where(user: self.user, question: self.question).destroy_all
|
||||||
|
|
||||||
Notification.notify self.question.user, self unless self.question.author_is_anonymous
|
Notification.notify self.question.user, self unless self.question.author_is_anonymous
|
||||||
self.user.increment! :answered_count
|
self.user.increment! :answered_count
|
||||||
self.question.increment! :answer_count
|
self.question.increment! :answer_count
|
||||||
|
|
Loading…
Reference in New Issue