Topic: Where'd my Flash Notice go?

I've got this method in my User controller:

def logout
    reset_session()
    flash[:notice] = "See you next time"
    redirect_to :controller => "home", :action => "show"
end

I'm not seeing the Flash Notice when I land on the homepage. Any ideas?

Re: Where'd my Flash Notice go?

Are you outputting it in the view?

<%= flash[:notice] %>

Railscasts - Free Ruby on Rails Screencasts

Re: Where'd my Flash Notice go?

Yes, I'm outputting in my application.rhtml. Works on every page in the app except this method. Does it have to do with me using redirect instead of render?

Re: Where'd my Flash Notice go?

Nope, but it probably has to do with the reset_session call. The flash information is stored in the session, and the reset probably doesn't take place until after the flash[] call (it might give the user a new session completely).

I don't know of a good solution though. There must be something to the new session.

Railscasts - Free Ruby on Rails Screencasts

Re: Where'd my Flash Notice go?

I have the following in my "login" controller and it works dandily. I did experience some problems when I accidently had it redirect to a local (same controller, login) action....


def logout
  reset_session
  flash[:message] = "You have been logged out."
  redirect_to :controller => 'home'
end

try copy and pasting that...