Class: Noticed::DeliveryMethods::Database

Inherits:
Base
  • Object
show all
Defined in:
lib/noticed/delivery_methods/database.rb

Instance Attribute Summary

Attributes inherited from Base

#logger, #notification, #options, #params, #recipient, #record

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#assign_args, inherited, options, #perform

Class Method Details

.validate!(options) ⇒ Object

Raises:

  • (ArgumentError)


9
10
11
12
13
14
# File 'lib/noticed/delivery_methods/database.rb', line 9

def self.validate!(options)
  super

  # Must be executed right away so the other deliveries can access the db record
  raise ArgumentError, "database delivery cannot be delayed" if options.key?(:delay)
end

Instance Method Details

#deliverObject

Must return the database record



5
6
7
# File 'lib/noticed/delivery_methods/database.rb', line 5

def deliver
  recipient.send(association_name).create!(attributes)
end