This commit is contained in:
parent
97b27248c2
commit
8b88827a00
|
@ -13,6 +13,9 @@ class AnswerController < ApplicationController
|
||||||
notif.update_all(new: false) unless notif.empty?
|
notif.update_all(new: false) unless notif.empty?
|
||||||
notif = Notification.where(target_type: "Smile", target_id: @answer.smiles.pluck(:id), recipient_id: current_user.id, new: true)
|
notif = Notification.where(target_type: "Smile", target_id: @answer.smiles.pluck(:id), recipient_id: current_user.id, new: true)
|
||||||
notif.update_all(new: false) unless notif.empty?
|
notif.update_all(new: false) unless notif.empty?
|
||||||
|
# @answer.comments.smiles throws
|
||||||
|
notif = Notification.where(target_type: "CommentSmile", target_id: @answer.comment_smiles.pluck(:id), recipient_id: current_user.id, new: true)
|
||||||
|
notif.update_all(new: false) unless notif.empty?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ class Answer < ActiveRecord::Base
|
||||||
has_many :comments, dependent: :destroy
|
has_many :comments, dependent: :destroy
|
||||||
has_many :smiles, dependent: :destroy
|
has_many :smiles, dependent: :destroy
|
||||||
has_many :subscriptions, dependent: :destroy
|
has_many :subscriptions, dependent: :destroy
|
||||||
|
has_many :comment_smiles, through: :comments, source: :smiles
|
||||||
|
|
||||||
after_create do
|
after_create do
|
||||||
Inbox.where(user: self.user, question: self.question).destroy_all
|
Inbox.where(user: self.user, question: self.question).destroy_all
|
||||||
|
|
Loading…
Reference in New Issue