TEST : First implementation of notification with Action Cable : alert message
This commit is contained in:
parent
f98bb90f08
commit
c533bb0a88
7 changed files with 48 additions and 2 deletions
|
@ -1,8 +1,14 @@
|
|||
class Notification < ActiveRecord::Base
|
||||
belongs_to :dossier
|
||||
|
||||
after_save :broadcast_notification
|
||||
|
||||
enum type_notif: {
|
||||
commentaire: 'commentaire'
|
||||
}
|
||||
|
||||
def broadcast_notification
|
||||
ActionCable.server.broadcast 'notifications',
|
||||
message: "Nouveau commentaire posté sur le dossier #{self.dossier.id}"
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue