I'm tinkering with Devise in Rails and storing sessions in MySQL (using the directive MyApp::Application.config.session_store :active_record_store
in config/initializers/session_store.rb
)
In my sessions table, I've got a session with a se开发者_如何学JAVAssion_id
and data
, both of which are unintelligible.
The session_id
is more or less random, as explained here. I'm not sure what's in the data, since this is a dummy app for now; the only data to know about this user is that it is signed in.
What I'm trying to understand is: How does Rails or Devise relate this session to a user? There's no user_id
column on a session (I assume for good reason).
Look in the request headers for a cookie matching your session_id.
精彩评论