class Async::Messaging::Notify

Public Class Methods

clear_all() click to toggle source
# File lib/async-messaging/notify.rb, line 19
def clear_all
  Mongoid::Message.delete_all
end
notify_user(target_user_instance, options={}) click to toggle source
# File lib/async-messaging/notify.rb, line 6
def notify_user(target_user_instance, options={})
  options[:subject] ||= ""
  options[:content] ||= "" 
  options[:category] ||= :flash
  options[:flags] ||= [:notice]
  # collect source user
  s = Async::Messaging.setup
  from_user_id = s.model_root.id
  target_user_id = target_user_instance.id
  # create document entry
  Mongoid::Message.create! options.merge({from: from_user_id, to: target_user_id})
end