Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
https://www.pivotaltracker.com/story/show/164082119
The original issue (bug) that I needed to fix was that only the last user email was being sent out. As it turns out, this is because in order to send multiple emails, you need to call the mailer method for each recipient. You can't iterate over them and call
mail(to:...
multiple times in the same call to the mailer.I also explored whether it was possible to make the user emails send via delayed job (feature). The original issue was that when a record is not persisted, such as when a user is deleted, delayed job errors out because it can't find that user. To get around this, you can create a class that holds all of the data of a project role, but isn't actually a project role. Thus I made the
ModifiedRole
class that's initialized with the attributes of each role that was deleted and is stored by delayed job itself so you don't run into the persistence issue.