Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails 3 and Devise. Kill current session

I got an Rails 3 app that uses Devise. I am just wondering how I can "kill" the current session?

This works but I do not know what it does

Devise.sign_out_all_scopes ? sign_out : sign_out(resource_name)

This does not work

current_user = nil

This does not work either

session[:current_user] = nil
like image 937
Jonathan Clark Avatar asked Jun 11 '11 11:06

Jonathan Clark


2 Answers

you can do like this

sign_out current_user 

or

sign_out :user     # sign_out(scope)

or

sign_out @user     # sign_out(resource)
like image 123
Muhammad Suleman Avatar answered Sep 30 '22 21:09

Muhammad Suleman


You probably want the sign_out method, and pass either the user or scope (eg :user) that you want to sign out.

Check out the Devise Ruby Doc for more information.

like image 21
SubmittedDenied Avatar answered Sep 30 '22 20:09

SubmittedDenied