Closed excid3 closed 2 months ago
Is this better than using this? Just wondering if there are advantages I’m not aware of.
class CommentNotifier < ApplicationNotifier
def initialize(comment)
@comment = comment
end
def recipients
@comment.post.commenters.excluding(@comment.user).uniq
end
def deliver
# implementation here
end
end
CommentNotifier.new(@comment).deliver
@misterhtmlcss I'm not following?
Currently, Noticed requires you to precompute the recipients of a Notifier.
Instead, we could move this into the Notifier and compute it internally
This greatly simplifies the code required in controllers or other locations where Notifiers are triggered.