Repository navigation
Conversation
Support Rails 5.1 + 5.0 by using the right arity for the proc. Rails 5.1 changed the arity from 0 to 1. See rails/rails#30391 and #4604 for details.
|
Hello @jbourassa, thanks for your report. Thank you! |
|
Hey @tegon, Here's a project where you can reproduce the issue: https://github.com/jbourassa/devise-4627-repro It's a stock Rails 5.1.4 + Devise project, with the following changes:
Steps to reproduce the issue:
|
|
@jbourassa I get it now, thank you for the test repo, it really helps. Thanks! |
|
This is fixed in Rails 5.1.5 btw. |
|
Good to know. So I'm closing this PR since it was a bug in the Rails framework. Thanks |
Rails allow procs and lambda with either zero or more argument. Devise however always tried to call instance_eval on those values, which does always pass one argument: self. There was a PR to fix this specific problem in Devise heartcombo#4627, before the arity check was fixed in rails itself: rails/rails#30391. But even if the problem was fixed in Rails, Devise was still calling the proc/lambas with instance_eval. That meant the fix added to Rails did not apply to Devise. The fix is to let Rails handle the :from and :reply_to defaults. We do that by unsetting the headers instead of trying to replicate Rails handling in Devise. This lets Rails handle it when setting up the mailer.
Rails allow procs and lambda with either zero or more argument. Devise however always tried to call instance_eval on those values, which does always pass one argument: self. There was a PR to fix this specific problem in Devise heartcombo#4627, before the arity check was fixed in rails itself: rails/rails#30391. But even if the problem was fixed in Rails, Devise was still calling the proc/lambas with instance_eval. That meant the fix added to Rails did not apply to Devise. The fix is to let Rails handle the :from and :reply_to defaults. We do that by unsetting the headers instead of trying to replicate Rails handling in Devise. This lets Rails handle it when setting up the mailer.
Support Rails 5.1 + 5.0 by using the right arity for the proc.
Rails 5.1 changed the arity from 0 to 1.
See rails/rails#30391 and #4604 for details.