3

I would like to redirect upon user destroy in devise with rails 3.1 How could this be implemented?

Rubytastic
  • 15,001
  • 18
  • 87
  • 175
  • I see my answer wasn't applicable to your question. Have you tried overriding the Devise registrations controller? You can put your own redirect_to logic in a delete action. I believe you need to create a new controller or edit the action in an existing one if you want to manage the User model. Try looking here [http://stackoverflow.com/questions/3546289/override-devise-registrations-controller] and this might also be helpful [http://www.tonyamoyal.com/2010/09/29/rails-authentication-with-devise-and-cancan-part-2-restful-resources-for-administrators/]. Good luck! – vich Dec 09 '11 at 14:13
  • Thx yes i have overridden some devise actions but couldn't figure out where the user delete code was stored, i read those topics and will override the reg controller later on to try if i can get the destroy action overriden – Rubytastic Dec 12 '11 at 12:08

1 Answers1

1

Try this in your ApplicationController (replacing new_user_session_path with the path of your choice

private

def after_sign_out_path_for(resource_or_scope)
  new_user_session_path
end
jamiescript
  • 1,284
  • 1
  • 11
  • 18