Class: Crier::Notification

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/crier/notification.rb

Instance Method Summary collapse

Instance Method Details

#to(audience) ⇒ Object

Shortcut for creating a private audience for this notification



19
20
21
22
23
24
# File 'lib/crier/notification.rb', line 19

def to(audience)
  self.update_column(:private, true)
  self.audience = (self.audience + Array(audience)).uniq

  return self
end

#to_others(audience) ⇒ Object



26
27
28
# File 'lib/crier/notification.rb', line 26

def to_others(audience)
  to(Array(audience) - [crier])
end