module Lifesaver::Notification::ModelAdditions::ClassMethods

Public Instance Methods

load_with_notifiable_associations(ids) click to toggle source
# File lib/lifesaver/notification/model_additions.rb, line 12
def load_with_notifiable_associations(ids)
  includes(notifiable_associations.on_notify).where(id: ids)
end
notifies_for_indexing(*args) click to toggle source
# File lib/lifesaver/notification/model_additions.rb, line 5
def notifies_for_indexing(*args)
  self.notifiable_associations = NotifiableAssociations.new
  options = args.last.is_a?(Hash) ? args.pop : {}
  notifiable_associations.populate(args, options)
  notification_callbacks
end

Private Instance Methods

notification_callbacks() click to toggle source
# File lib/lifesaver/notification/model_additions.rb, line 18
def notification_callbacks
  before_destroy do
    send :load_associations, :destroy
  end
  after_commit do
    send :update_associations
  end
end