TEST : First implementation of notification with Action Cable : alert message

This commit is contained in:
Xavier J 2016-12-22 22:27:02 +01:00
parent f98bb90f08
commit c533bb0a88
7 changed files with 48 additions and 2 deletions

View file

@ -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