Class: Notification

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
AASM
Defined in:
app/models/notification.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.create_notification_of_type(notification_type, dyn_attributes = {}, created_by = nil) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'app/models/notification.rb', line 25

def create_notification_of_type(notification_type, dyn_attributes={}, created_by=nil)
  notification_type = notification_type.class == NotificationType ? notification_type : NotificationType.find_by_internal_identifier(notification_type)

  notification = self.new(
      created_by: created_by,
      notification_type: notification_type
  )

  dyn_attributes.each do |k,v|
    notification.custom_fields[k] = v
  end

  notification.save

  notification
end

Instance Method Details

#deliver_notificationObject



44
45
46
47
# File 'app/models/notification.rb', line 44

def deliver_notification
  # template method
  # should be overridden in sub class
end