How to get session values in rails 2.3


#1

in rails 2.3.0

DEPRECATION WARNING: Disabling sessions for a single controller has been
deprecated. Sessions are now lazy loaded. So if you don’t access them,
consider them off. You can still modify the session cookie options with
request.session_options… (called from
app/controllers/application_controller.rb:9)

how can i modify the session cookie options with request.session_options
?

urgent help


#2

On 4 Mar 2009, at 11:01, Sniper A. wrote:

What it’s telling you is that

class FooController
session :off
end

is no longer necessary since sessions are not loaded unless accessed.
(and that you can set session options with
request.session_options[‘some_key’]= ‘some_value’ (eg if you want to
change the expiry date)

Fred

how can i modify the session cookie options with
request.session_options
?

urgent help

http://www.catb.org/~esr/faqs/smart-questions.html#urgent


#3

Frederick C. wrote:

On 4 Mar 2009, at 11:01, Sniper A. wrote:

What it’s telling you is that

class FooController
session :off
end

is no longer necessary since sessions are not loaded unless accessed.
(and that you can set session options with
request.session_options[‘some_key’]= ‘some_value’ (eg if you want to
change the expiry date)

Fred

Thanks for ur reply

i created a new rails(2.3.0) project
ActionController::Base.session_store = :active_record_store
at login (in session controller , create action)
session[:id]=current_user.id

after that
redirect_to :controller =>“home”

in debugger mode (at home controller ,index action)

Completed in 156ms (DB: 46) | 302 Found
[http://localhost/session/create]
D:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.0/lib/action_controller/base
.rb:1262
default_render unless performed?
(rdb:2) session
{}
(rdb:2) session[:id]
nil

here one question, where is my session value ?

i searched arround net and i got
http://guides.rails.info/2_3_release_notes.html#rack-based-lazy-loaded-sessions

there is a line like this
“Session stores are now lazy loaded. If you never access the session
object during a request, it will never attempt to load the session data
(parse the cookie, load the data from memcache, or lookup an Active
Record object).”

pls check that line

If you never access the session object during a request, it will never attempt

i don’t know how to get my session ?