views:

452

answers:

1

Hi,

In rails 2.3, I changed session store from cookies to active_record. I compared session.inspect between the two stores. In cookie_store, it showed a lot of info but in active_record_store it showed nothing(just {}).

My main concert is session_id. You can't get session[:session_id] in active_record_store. Is this right behavior? Do I have to see session differently according to session store option?

Sam

+4  A: 

Why are you trying to get access to session_id? You should treat the session as a hash that Rails creates for you. So for instance, if you did:

def some_action
  session[:name] = "wycats"
end

In a subsequent action you would be able to do:

def some_action
  session[:name] # will be "wycats"
end

In other words, the session is a Hash that persists across requests.

Yehuda Katz
Wow, you are the famous guy.I'm honored.Thank you.
Sam Kong