-
Notifications
You must be signed in to change notification settings - Fork 21.9k
ActionMailer fails on rails 6.1.6.1 and ruby 3.2 #46883
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
Comments
Hey @javiyu, thanks for opening an issue! Can you post the whole stacktrace for the error you are seeing? |
|
Thank you for the issue. Rails 6.1 only receives security bug fixes. At the moment it doesn't work with Ruby 3.2. We are open to a PR that make the test pass and add support to Ruby 3.2 for the 6-1-stable branch, but we are not going to do the work. |
The same happens to me in Rails 7.0.4 |
I believe the mail gem changing it's argument is fixed in main at this point, but you can also resolve it by using the previous Unsure what other issues you'll hit with ruby 3.2 |
Does it happen only when running in a test? |
This could be a different issue then. When I traced it, the problem was that I was using a double splat ( |
Not applicable for ruby 3.2 as it is not supported. See: rails/rails#46883 (comment)
I still see this issue with This is how I could resolve it, however: class ApplicationMailer < ActionMailer::Base
# ...
# This patch accounts for the error
#
# ArgumentError:
# wrong number of arguments (given 1, expected 0; required keywords:
#
# which has appeared with the switch to ruby 3.2.
#
# References:
# - https://github.com/rails/rails/issues/46883
# - https://github.com/rails/rails/issues/44846
# - https://stackoverflow.com/q/76262079/2066546
#
def send_action(*args)
if args.second.kind_of? Hash
super(args.first, **args.second)
else
super
end
end
end I realise that this issue considers rails 6. However, I found this issue in my search for a resolution. Feel free to delete my comment if it is inappropriate here. I would appreciate if you could redirect me to the correct issue then. |
@fiedl I didn't test...but strongly suspect that this is fixed in the more recent versions of rails 7.2. Looks like you're on a beta. Update rails |
Steps to reproduce
When I try to execute a mailer that accepts kwargs
I get the following error.
The same code was working on ruby 3.1. I have debugged the code and if I monkey patch the app with the following snippet the error goes away.
I don't have a lot of time right now to create the tests scenarios, if adding just the patch is enough I can open a PR myself.
Expected behavior
The call should succeed.
Actual behavior
The call fails and raises the following error:
System configuration
Rails version: 6.1.6.1
Ruby version: 3.2.0
The text was updated successfully, but these errors were encountered: