最初,我只在我的 heroku 应用程序上遇到这个问题,但是在将设计 gem 更新到 2.2.4 后,我的本地主机上也有这个问题。
我主要担心的是我收到了这个错误:
ArgumentError (wrong number of arguments (2 for 1)):
app/mailers/user_mailer.rb:58:in `reset_password_instructions'
我已将设计 gem 更新为
devise (2.2.4)
我正在运行:
Rails 3.2.11
我的 development.rb 初始化程序具有以下主机:
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
这是我的 user_mailer.rb 文件中第 58 行的开始位置:
def reset_password_instructions(user)
devise_mail(user, :reset_password_instructions)
end
我的问题是,为什么我要发送两个论点?它应该只在我的 devise/passwords/new.html.erb 文件中定义的电子邮件地址中发送:
<div class="container">
<%= form_for(resource, :html => {:class => "form-signin", :method => :post}, :as => resource_name, :url => password_path(resource_name)) do |f| %>
<h2 class = "form-signin-heading">Forgot your password?</h2>
<%= devise_error_messages! %>
<%= f.email_field :email, :type => "text", :class =>"input-block-level", :placeholder => "Email Address" %>
<%= f.submit "Send me reset password instructions", :class => "btn btn-large btn-primary" %>
</br>
</br>
<%= render "devise/shared/links" %>
<% end %>
</div>
编辑: 我的 reset_password_instructions.html.erb 文件在这里:
<p>Hello <%= @resource.email %>!</p>
<p>Someone has requested a link to change your password, and you can do this through the link below.</p>
<p><%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token =>@resource.reset_password_token) %></p>
<p>If you didn't request this, please ignore this email.</p>
<p>Your password won't change until you access the link above and create a new one.</p>
任何人都可以发现问题吗?