lib/action_cable_notifications/model.rb
def notify_create
      self.ChannelPublications.each do |publication, options|
        if options[:actions].include? :create
          # Checks if records is within scope before broadcasting
          records = self.class.scoped_collection(options[:scope])

          if options[:scope]==:all or record_within_scope(records)
            ActionCable.server.broadcast publication,
              msg: 'create',
              id: self.id,
              data: self
          end
        end
      end
    end
def notify_create
      self.ChannelPublications.each do |publication, options|
        if options[:actions].include? :create
          # Checks if records is within scope before broadcasting
          records = self.class.scoped_collection(options[:scope])

          if options[:scope]==:all or record_within_scope(records)
            ActionCable.server.broadcast publication,
              msg: 'create',
              id: self.id,
              data: self
          end
        end
      end
    end
Broadcast notifications when a new record is created