Acts_as_authenticated, reset_session, and redirect_back_or_d

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
redirect.

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
else
redirect_to(request.env[“HTTP_REFERER”]) # same as
redirect_to :back
end
end

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 C.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs