Module: ActivityNotification::Notifier

Extended by:
ActiveSupport::Concern
Includes:
Association, Common
Defined in:
lib/activity_notification/models/concerns/notifier.rb

Overview

Notifier implementation included in notifier model to be notified, like users or administrators.

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Association

belongs_to_composite_xdb_record, belongs_to_polymorphic_xdb_record, filtered_by_association, has_many_composite_xdb_records, has_many_polymorphic_xdb_records, has_many_records, #update

Methods included from Common

#printable_name, #printable_type, #resolve_value, #to_class_name, #to_resource_name, #to_resources_name

Class Method Details

.available_as_notifier?Boolean

Checks if the model includes notifier methods are available.

Returns:

  • (Boolean)

    Always true



24
25
26
# File 'lib/activity_notification/models/concerns/notifier.rb', line 24

def available_as_notifier?
  true
end

.set_notifier_class_defaultsNilClass

Sets default values to notifier class fields.

Returns:

  • (NilClass)

    nil



30
31
32
33
# File 'lib/activity_notification/models/concerns/notifier.rb', line 30

def set_notifier_class_defaults
  self._printable_notifier_name = :printable_name
  nil
end

Instance Method Details

#printable_notifier_nameString

Returns printable notifier model name to show in view or email.

Returns:

  • (String)

    Printable notifier model name



38
39
40
# File 'lib/activity_notification/models/concerns/notifier.rb', line 38

def printable_notifier_name
  resolve_value(_printable_notifier_name)
end

#sent_notificationsArray<Notificaion>, Mongoid::Criteria<Notificaion>

Has many sent notification instances from this notifier.

Returns:

  • (Array<Notificaion>, Mongoid::Criteria<Notificaion>)

    Array or database query of sent notifications from this notifier



13
14
15
# File 'lib/activity_notification/models/concerns/notifier.rb', line 13

has_many_records :sent_notifications,
class_name: "::ActivityNotification::Notification",
as: :notifier