Rails allow procs and lambda with either zero or more argument as values for the different defaults. Devise however always tried to call instance_eval on those values, which does always pass one argument: self.
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 corresponding headers instead of duplicate the way Rails handles callables in Devise. This lets Rails handle the values when setting up the mailer.
Rails allow
procs
andlambda
with either zero or more argument as values for the different defaults. Devise however always tried to callinstance_eval
on those values, which does always pass one argument:self
.There was a PR to fix this specific problem in Devise https://github.com/heartcombo/devise/pull/4627, before the arity check was fixed in rails itself: https://github.com/rails/rails/pull/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 corresponding headers instead of duplicate the way Rails handles callables in Devise. This lets Rails handle the values when setting up the mailer.