class HocNotifications::HocNotification

Public Class Methods

create_notifications(sender:, recipients:, notifiable:, action:, title:, message:, **data) click to toggle source
# File lib/hoc_notifications/active_record/hoc_notification.rb, line 20
def self.create_notifications(sender:, recipients:, notifiable:, action:, title:, message:, **data)
  recipients.each do |recipient|
    create(sender: sender,
           recipient: recipient,
           notifiable: notifiable,
           action: action,
           data: data,
           seen_at: nil,
           title: title,
           message: message
         )
  end
end

Public Instance Methods

mark_as_seen() click to toggle source
# File lib/hoc_notifications/active_record/hoc_notification.rb, line 34
def mark_as_seen
  update_attributes(seen_at: Time.current)
end