def notify_destroy
      self.ChannelPublications.each do |publication, options|
        if options[:scope]==:all or options[:actions].include? :destroy
          # Checks if record is within scope before broadcasting
          if options[:scope]==:all or record_within_scope(self.class.scoped_collection(options[:scope])).present?
            ActionCable.server.broadcast publication,
              msg: 'destroy',
              id: self.id
          end
        end
      end
    end
def notify_destroy
      self.ChannelPublications.each do |publication, options|
        if options[:scope]==:all or options[:actions].include? :destroy
          # Checks if record is within scope before broadcasting
          if options[:scope]==:all or record_within_scope(self.class.scoped_collection(options[:scope])).present?
            ActionCable.server.broadcast publication,
              msg: 'destroy',
              id: self.id
          end
        end
      end
    end
Broadcast notifications when a record is destroyed.