Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

get session id from warden or devise

I need to grab the session id for a user and use it preferably in a model.

Here's the gist:

1) I have a list of proposals. 2) Unregistered users can create proposals and their session id is saved to them. 3) When a user registers or logs in their session id should be matched with proposals. 4) Then their user id should be saved to the proposal as well.

I've thought about overriding Devise controllers or using Warden hooks within the rails application file but these solutions seem messy.

like image 262
atomical Avatar asked Jun 10 '11 14:06

atomical


1 Answers

You can use the following in controllers or views:

session['session_id']
=> '69384476b67fa4c2d1e3cc340eb4e951'
like image 161
Brett Bender Avatar answered Nov 17 '22 02:11

Brett Bender