DoubleRenderError when overriding after_confirmation_path_for

342 views
Skip to first unread message

Martin Vann Nostrand

unread,
Feb 10, 2013, 1:05:05 AM2/10/13
to plataforma...@googlegroups.com
After confirmation, I would like to send the user to a screen where they enter in some profile details.  I have seen other people online talking about how they have done this, however I haven't seen anyone discussing this error.  Any help would be appreciated!

I have overridden the confirmations controller with:

class ConfirmationsController < Devise::ConfirmationsController
  def after_confirmation_path_for(resource_name, resource)
    redirect_to new_profile_path
  end
end

And I have added the following to my routes:

devise_for :users, :controllers => { :confirmations => "confirmations" }

However, after confirming an account, I get the following error in browser:

AbstractController::DoubleRenderError in ConfirmationsController#show 


Render and/or redirect were called multiple times in this action. Please note that you may only call render OR redirect, and at most once per action. Also note that neither redirect nor render terminate execution of the action, so if you want to exit an action after redirecting, you need to do something like "redirect_to(...) and return".

Dheeraj Kumar

unread,
Feb 10, 2013, 1:08:03 AM2/10/13
to plataforma...@googlegroups.com
replace redirect_to new_profile_path with new_profile_path

-- 
Dheeraj Kumar

--
 
---
You received this message because you are subscribed to the Google Groups "Devise" group.
To unsubscribe from this group and stop receiving emails from it, send an email to plataformatec-de...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Muhammad Abid Mahmood

unread,
Feb 10, 2013, 5:49:30 AM2/10/13
to plataforma...@googlegroups.com
You should not redirect inside after_confirmation_path_for

You should instead return the path where you want it to be redirected after confirmation

 def after_confirmation_path_for(resource_name, resource)
    new_profile_path
 end
--
Remember that in the final choice a soldier's pack is not so heavy a burden as a prisoner's chains
Muhammad Abid Mahmood
Reply all
Reply to author
Forward
0 new messages