mostrar notificaciones a los usuarios cuando alguien comenta en su

debate o responde a su comentario
This commit is contained in:
Julian Herrero
2015-10-06 12:11:20 +02:00
committed by rgarcia
parent ba0ce4e14b
commit d9ba3edc2a
17 changed files with 304 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
class Notification < ActiveRecord::Base
belongs_to :user
belongs_to :activity
scope :unread, -> { where(read: false) }
scope :recent, -> { order(id: :desc) }
scope :for_render, -> { includes(activity: [:user, :trackable]) }
def timestamp
activity.trackable.created_at
end
end