使用 Wicked 时参数数量错误(1 代表 0)错误 gem

wrong number of arguments (1 for 0) error while using Wicked gem

我在最后一步注册用户时遇到此错误,用户已注册,但我不知道为什么会出现此错误。

private
 def redirect_to_finish_wizard
  redirect_to root_url, notice: "Thanks for signing up."
 end

请任何解决方案

尝试如下更改您的 redirect_to_finish_wizad 方法:

private

  def redirect_to_finish_wizard(options = nil)
    redirect_to root_path , notice: "Thank you for signing up."
  end

这将解决您的问题。有关方法的更多信息,请参阅 here.

gem似乎又被修改了,redirect_to_finish_wizard方法接受2个参数而不是1个。

如果前面的代码损坏,请尝试如下更改 redirect_to_finish_wizard 方法:

private

  def redirect_to_finish_wizard(options = nil, params = nil)
    redirect_to root_path , notice: "Thank you for signing up."
  end