Class: Notification

Inherits:
ApplicationRecord show all
Defined in:
app/models/notification.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApplicationRecord

active_between, aggregate_of, all_except, defaults, #delete, #destroy!, enum_prefixed_translations_for, numbered, organic_on, resource_fields, #save, #save_and_notify!, #save_and_notify_changes!, serialize_symbolized_hash_array, teaser_on, #update_and_notify!, update_or_create!, whitelist_attributes, with_pg_retry, with_temporary_token

Methods included from WithPgLock

#with_pg_lock

Class Method Details

.create_and_notify_via_email!(args) ⇒ Object



19
20
21
# File 'app/models/notification.rb', line 19

def self.create_and_notify_via_email!(args)
  create!(args).tap(&:notify_via_email!)
end

Instance Method Details

#mark_as_read!Object



15
16
17
# File 'app/models/notification.rb', line 15

def mark_as_read!
  update read: true
end

#notify_via_email!Object



23
24
25
# File 'app/models/notification.rb', line 23

def notify_via_email!
  user.notify_via_email! self
end