Topic: flash[:notice] not showing after reset_session
I've seen a post suggesting the flash variable is also cleared when the session is reset, but haven't managed to find any suggestions on what to do to get this to work..
I am using 2 filters (prepare_session, then login_required) before processing an action.
But my session has expired (as expected), so instead of seeing the view associated with my action, I am redirected to my login page, which should display my flash[:notice] variable, but I am not seeing it. I do however, see the flash[:notice] for this same situation but where the session hasn't expired (when user is not logged in).
Would really appreciate some help!
thanks, Serena.
def prepare_session
creation_time = session[:creation_time] || Time.now
if !session[:expiry_time].nil? and session[:expiry_time] < Time.now
#Session has expired. Clear the current user from the session
reset_session
end
# Assign a new expiry time, whether the session has expired or not
session[:expiry_time] = MAX_SESSION_TIME.seconds.from_now
return true
end
def login_required
unless session[:account].nil?
return true
end
flash[:notice] = "You are not logged in"
redirect_to :action => "login"
return false
end