When a user logout, the session is deleted, so I can''t use a flash[:notice] stating that the user has been disconnected (and more...) in my _header.rhtml view <%= link_to ''Logout'', logout_path %> in my route.rb map.logout ''logout'', :controller => ''session'', :action => ''destroy'' in my session_controller.rb def destroy session.delete cookies.delete :login_token flash[:notice] = "You have been disconnected" redirect_to home_path end in my application.rhtml layout <% if flash[:notice] -%><div><%= flash[:notice] %></div><% end %> when a session is deleted, it'' clears all variables.. I thought I could write a flash[notice] to be displayed, but it seems not to be the case... any clue ? thanks kad -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Dustin Anderson
2007-Aug-10 15:21 UTC
Re: how to display a message after logout (session deleted)
> in my session_controller.rb > def destroy > session.delete > cookies.delete :login_token > flash[:notice] = "You have been disconnected" > redirect_to home_path > endCan you set some new variable to be passed (make your own flash) - do something like:> in my session_controller.rb > def destroy > session.delete > cookies.delete :login_token > flash[:notice] = "You have been disconnected"@myflash = "You have been disconnected"> redirect_to home_path > endBut then you''d have to delete the @myflash variable once you redirect_to_home_path -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Dustin Anderson wrote:>> in my session_controller.rb >> def destroy >> session.delete >> cookies.delete :login_token >> flash[:notice] = "You have been disconnected" >> redirect_to home_path >> end > > Can you set some new variable to be passed (make your own flash) - do > something like:it should be a session variable...> >> in my session_controller.rb >> def destroy >> session.delete >> cookies.delete :login_token >> flash[:notice] = "You have been disconnected" > @myflash = "You have been disconnected" > >> redirect_to home_path >> end > > But then you''d have to delete the @myflash variable once you > redirect_to_home_pathonce I am redirected the @myflash variable doesn''t exist anymore (?) a session variable will carry the message.. but a flash[] is a session variable too.. and it''s = nil after redirected , don''t understand why ..... my exampel is not completly written from scratch.. it''s taken from the ''beast'' example, and it''s doesn''t run well too in this example... I am not wrong alone ..... -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Russell Norris
2007-Aug-11 12:45 UTC
Re: how to display a message after logout (session deleted)
Why not just nullify the proper session variables instead of emptying out the whole thing? RSL On 8/10/07, Kad Kerforn <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > When a user logout, the session is deleted, so I can''t use a > flash[:notice] stating that the user has been disconnected (and more...) > > in my _header.rhtml view > <%= link_to ''Logout'', logout_path %> > > in my route.rb > map.logout ''logout'', :controller => ''session'', :action => ''destroy'' > > in my session_controller.rb > def destroy > session.delete > cookies.delete :login_token > flash[:notice] = "You have been disconnected" > redirect_to home_path > end > > in my application.rhtml layout > <% if flash[:notice] -%><div><%= flash[:notice] %></div><% end %> > > when a session is deleted, it'' clears all variables.. I thought I could > write a flash[notice] to be displayed, but it seems not to be the > case... any clue ? > > thanks > > kad > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Kad Kerforn
2007-Aug-19 09:17 UTC
Re: how to display a message after logout (session deleted)
RSL ___ wrote:> Why not just nullify the proper session variables instead of emptying > out > the whole thing? > > RSLtoo smart.. rethinking a little bit => no need for session.delete only cookie :login.token need to be deleted to avoid an auto login again.... thnaks ! -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
miskovac
2007-Aug-30 16:33 UTC
Re: how to display a message after logout (session deleted)
you can simple type reset_session and all will be reseted as first time user was entered to site. On Aug 19, 11:17 am, Kad Kerforn <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> RSL ___ wrote: > > Why not just nullify the proper session variables instead of emptying > > out > > the whole thing? > > > RSL > > too smart.. rethinking a little bit => no need for session.delete only > cookie :login.token need to be deleted to avoid an auto login again.... > > thnaks ! > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---