Hi, I''m using the authentication-process from the Recipes-book. Works fine, only when the user puts in a wrong password or username, I get the RuntimeError-message and -window, from the raise-command. I would much prefer to redirect to some other URL, but because the raise-message is put into the user-model, ''redirect_to'' does not work. Anybody with suggestions how to safely redirect here? Thanks in advance. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Andrew Stewart
2006-Dec-29 09:55 UTC
Re: Safest way to avoid RuntimeError_window in authetication?
> I''m using the authentication-process from the Recipes-book. Works > fine, > only when the user puts in a wrong password or username, I get the > RuntimeError-message and -window, from the raise-command. I would much > prefer to redirect to some other URL, but because the raise-message is > put into the user-model, ''redirect_to'' does not work. > Anybody with suggestions how to safely redirect here? > Thanks in advance.You could either rescue the exception in your controller and then redirect or, perhaps neater, return nil from your model instead of raising an exception and redirect in the controller when you see a nil user. Regards, Andy Stewart --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---