rubyonrailsin

A Ruby and Rails talk

Sunday, March 21, 2010


[Rails] Logging out feature

by rubyonrailsin 0 comments

Tag


Share this post:
Design Float
StumbleUpon
Reddit

Logging out feature,

Code:

def logout
@title = "Login - Books"

session[:user_id] != nil
flash[:notice] = "You have sucessfully been logged out !"
redirect_to :controller => :books, :action => :index
end
end

^^when this is run, it logs the user out (nill) and displays you have
successfully been logged out,

Code v2:
def logout
@title = "Login - Books"

session[:user_id] != nil
flash[:notice] = "You have sucessfully been logged out
#{@user.screen_name} !"
redirect_to :controller => :books, :action => :index
end
end

^^what i was hoping this would do is to display the users name as well,
(this is another task), i understand the session but how can i bring the
session back while the session is nill :S

thanks once again mates,

Jagmit Gabba
--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment

Subscribe feeds via e-mail

Blog Archive