Skip to content

wrong number of arguments (given 1, expected 0) during password reset… - #4604

Closed
terryyin wants to merge 1 commit into
heartcombo:masterfrom
terryyin:patch-1
Closed

terryyin wants to merge 1 commit into
heartcombo:masterfrom
terryyin:patch-1

Conversation

@terryyin

@terryyin terryyin commented Aug 2, 2017

Copy link
Copy Markdown

…. Rails 5.1.2

Since Rails 5.1.2, the default headers in ActionMailer behave differently if they are Proc. It doesn't take any parameter.

…. Rails 5.1.2

Since Rails 5.1.2, the default headers in ActionMailer behave differently if they are Proc. It doesn't take any parameter.
@jbourassa

Copy link
Copy Markdown

I am getting this too, but I think there are a couple things that are not working with the proposed solution:

  • If the Proc has an arity greater than 1, this will crash on prior Rails versions (you said 5.1.2, but I think it has been merged in 5.1)
  • Rails now uses instance_exec – simply calling the method will not yield the same results.

Do you want to update this PR or should I create a new one?

@terryyin

Copy link
Copy Markdown
Author

You can create another PR, just wanted to point out the problem.

Actually in other places I simply add a default parameter to the Proc (_=nil).

But the question is how can we remember to remove this after some time?

@jbourassa

Copy link
Copy Markdown

But the question is how can we remember to remove this after some time?

Not sure that's a major issue. According to the PR I opened on Rails, they may want to keep both 1 and 0 arg.

@terryyin

Copy link
Copy Markdown
Author

In that case, isn't a default parameter good enough solution?

@jbourassa

Copy link
Copy Markdown

In that case, isn't a default parameter good enough solution?

It's good enough to use in your mailers, but Devise should work with more than just Rails 5.1, so to support both version you have to do this trickery.

@tegon

tegon commented Dec 23, 2017

Copy link
Copy Markdown
Member

Hello @terryyin, thanks for your report.
I've just tested here with a new Rails 5.1.4 application and I haven't got this error during password reset.
Can you provide us a sample application that reproduces the issue in isolation?
That would help us find the issue.

Thank you!

@tegon

tegon commented Feb 9, 2018

Copy link
Copy Markdown
Member

Closing in favor of #4627

@tegon tegon closed this Feb 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants