What am I missing?

There’s got to be a simple answer to this…

def logout
reset_session
flash[:notice] = “Logged out”
redirect_to :action => ‘index’
end

The flash never shows up, and doesn’t seem to be in the new session.

–Al Evans

I ran into this one too. The problem is since you reset the session,
and the flash is stored in the session there is no way to access it
again, as the session key is destroyed.

My workaround was to just pass that info in the url as follows:

redirect_to login_url(:expired => @session_expired)

And in my case, I will display how long ago the session expired.

Tom

On 5/17/06, Al Evans [email protected] wrote:

–Al Evans


Posted via http://www.ruby-forum.com/.


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails


Tom D.

http://blog.atomgiant.com
http://gifthat.com

Tom D. wrote:

My workaround was to just pass that info in the url as follows:

redirect_to login_url(:expired => @session_expired)

Thanks. That works fine, except for ending up with the message appended
to the URL. I guess I can’t have everything:-)

Thank you, too, Greg, for the explanation.

–Al Evans

On Wed, May 17, 2006 at 06:41:07PM +0200, Al Evans wrote:
} There’s got to be a simple answer to this…
}
} def logout
} reset_session
} flash[:notice] = “Logged out”
} redirect_to :action => ‘index’
} end
}
} The flash never shows up, and doesn’t seem to be in the new session.

The session is tied to a cookie on the client browser. When you call
reset_session, you get rid of the session connected to that cookie. When
a
a page is rendered, the cookie is updated, but you are redirecting. My
suspicion is that either rails does not send the new cookie with a 3xx
redirect response or the client browser ignores a cookie in a 3xx
response.
Once the index action is being rendered, it is already too late.

} --Al Evans
–Greg