Skip to content

a case for deliver_by database #414

Answered by excid3
madhums asked this question in Q&A
Discussion options

You must be logged in to vote

I would filter the recipients beforehand if you want to completely skip certain recipients.

class Post < ApplicationRecord
  def email_notifications?(recipient)
    # your filter logic
  end

  private

  def notify
    participants = (discussion.participants + [discussion.user]).uniq.select{ |user| email_notifications?(user) }
    NewPostNotifier.with(record: self, discussion:, story: discussion.story).deliver_later(participants)
  end
end

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@madhums
Comment options

Answer selected by madhums
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants