Forum: Ruby on Rails acts_as_authenticated, reset_session, and redirect_back_or_d

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
C65436946251c32cb1dccb36901dee70?d=identicon&s=25 Charles Churchill (Guest)
on 2007-06-30 01:10
(Received via mailing list)
Just a question and an FYI
I just installed rails and acts_as_authenticated and was setting up a
site.  Everything works fine except that in the AccountController that
I generated the calls to the routine redirect_back_or_default don't
work because the call just before it to reset_session clears the
session[:return_to] that the method uses to set where it will

I ended up adding a version of redirect_back_or_default to the account
controller that works for me (and as a benefit it keeps me from having
to set session[:return_to] which stunk)

def redirect_back_or_default(default)
   if request.env["HTTP_REFERER"].nil?
      redirect_to default
      redirect_to(request.env["HTTP_REFERER"]) # same as
redirect_to :back

My question is, am I just missing something, is there a different
version of code out there, or is this thing really broken.

Anyway, thanks,
Charles Churchill
This topic is locked and can not be replied to.