-
-
Notifications
You must be signed in to change notification settings - Fork 178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to pass arguments to email methods #299
Comments
I'm not sure. How do you envision the user defining those it in their Notification object? |
I set up my own custom delivery method and this is how I specified the params and args. I kinda like
The recipient is merged so it isn't necessary, but I'm just showing how it would work if you did have other params to pass. |
So a complete example might look like this: class CommentNotification < Noticed::Base
delivers_by :email, mailer: "UserMailer", params: :params_for_email, arguments: :args_for_email
# Should return an array of arguments
def arguments_for_email
[comment, post]
end
def params_for_email
{}
end
end Seems fine to me. 👍 For backwards compatibility, we'd need to support |
Yep! I need to make sure it works with named arguments as well, but will put together a PR for you to check out when I get a chance! |
While you're in there, would you mind changing |
You bet! Thanks @excid3 for putting this code together! |
I'm not sure if this follows the opinion of Noticed, but some mailer methods accept both params and arguments. I believe the current
email_format
method only really sets the params. So for example, Noticed can't send an email notification to a mailer method like this:UserMailer.with({ recipient: User.first }).new_comment(comment)
Is this something Noticed should support? If so, I can take a crack at a PR.
The text was updated successfully, but these errors were encountered: