1
votes

When I call to retrieve the password function I get:

error info::: SystemStackError in PasswordsController#create stack level too deep

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
2
that usually means you are doing something recursively and its not terminating. - sevenseacat
I find the problem,in my devise.rb,I used require 'devise_resque_mailer' and config.mailer = 'DeviseResqueMailer', then I remove this, it works. - scottxu

2 Answers

2
votes

I met the same problem, my solution is as follows:

=begin
  require 'devise_resque_mailer'
  config.mailer = 'DeviseResqueMailer'
=end
1
votes

Infinite Loop

As a rule, Stack Level Too Deep generally means a part of your application has an infinite loop

--

Code

This is the devise version:

  #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

Looking at your code, the issue is likely that you're either referencing the successfully_sent? method incorrectly, you didn't close your if, and you are not using the strong_params pattern:

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

Without seeing the rest of your controller, I can only recommend fixing the above issues I raised