From aec3e1c8004b534692b9be37a55da946ade16bd1 Mon Sep 17 00:00:00 2001 From: nilsding Date: Sat, 3 Jan 2015 19:02:56 +0100 Subject: [PATCH] if a question was answered, all occurrences of it in the inbox are now gone --- app/models/answer.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/models/answer.rb b/app/models/answer.rb index 917476bd..e346853b 100644 --- a/app/models/answer.rb +++ b/app/models/answer.rb @@ -5,6 +5,8 @@ class Answer < ActiveRecord::Base has_many :smiles, dependent: :destroy 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 self.user.increment! :answered_count self.question.increment! :answer_count