mostrar notificaciones a los usuarios cuando alguien comenta en su
debate o responde a su comentario
This commit is contained in:
12
app/models/notification.rb
Normal file
12
app/models/notification.rb
Normal 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
|
||||
Reference in New Issue
Block a user