Skip to content

Commit

Permalink
Add docs for PR #459 (#482)
Browse files Browse the repository at this point in the history
This adds info about #459 to the README.
  • Loading branch information
ghiculescu authored Aug 27, 2024
1 parent 6199c82 commit b2f4e3c
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,34 @@ This invocation will create a single `Noticed::Event` record and a `Noticed::Not
- An individual delivery job for `:email` method to the second thread author
- Etc...

#### Tip: Define recipients inside the notifier

Recipients can also be computed inside a notifier:

```ruby
class NewCommentNotifier < ApplicationNotifier
recipients ->{ params[:record].thread.all_authors }
# or
recipients do
params[:record].thread.all_authors
end
# or
recipients :fetch_recipients
def fetch_recipients
# ...
end
end
```

This makes the code for sending a notification neater:

```ruby
NewCommentNotifier.with(record: @comment, foo: "bar").deliver
```

### Custom Noticed Model Methods

In order to extend the Noticed models you'll need to use a concern and a to_prepare block:
Expand Down

0 comments on commit b2f4e3c

Please sign in to comment.