当我打电话来检索密码功能时,我得到:
错误信息::: PasswordsController中的SystemStackError #create stack 水平太深
html:
<%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post, :class => 'well form-inline' }) do |f| %>
<span style="font-size:14px;margin-right:10px">email:</span>
<%= f.email_field :email %>
<%= f.submit "submit", :class => "btn btn-success", :style => "margin-left:10px" %>
passwords_controller:
def create
self.resource = resource_class.send_reset_password_instructions(params[resource_name])
if successfully_sent?(resource)
#respond_with({}, :location => after_sending_reset_password_instructions_path_for(resource_name))
respond_to do |format|
format.html { redirect_to after_sending_reset_password_instructions_path_for(resource_name) }
format.json { render :json => {:info=>"aaa" }.to_json }
end
else
respond_to do |format|
format.html { redirect_to new_password_path(resource_name),:notice => "bbb" }
format.json { render :json => {:errors=>"ccc" }.to_json }
end
end
答案 0 :(得分:2)
我遇到了同样的问题,我的解决方案如下:
=begin
require 'devise_resque_mailer'
config.mailer = 'DeviseResqueMailer'
=end
答案 1 :(得分:1)
无限循环
通常,Stack Level Too Deep
通常表示您的应用程序的一部分有infinite loop
-
<强>代码强>
#app/controllers/devise/passwords_controller.rb
def create
self.resource = resource_class.send_reset_password_instructions(resource_params)
yield resource if block_given?
if successfully_sent?(resource)
respond_with({}, location: after_sending_reset_password_instructions_path_for(resource_name))
else
respond_with(resource)
end
end
查看您的代码,问题很可能是您错误地引用了successfully_sent?
方法,您没有关闭if
,并且您没有使用strong_params
模式:
def create
self.resource = resource_class.send_reset_password_instructions(params[resource_name])
if successfully_sent?(resource)
respond_to do |format|
format.html { redirect_to after_sending_reset_password_instructions_path_for(resource_name) }
format.json { render :json => {:info=>"aaa" }.to_json }
end
else
respond_to do |format|
format.html { redirect_to new_password_path(resource_name) }
format.json { render :json => {:errors=>"ccc" }.to_json }
end
end
end
如果没有看到控制器的其余部分,我只能建议修复我提出的上述问题