# How to get session values in rails 2.3

**URL:** <https://www.ruby-forum.com/t/how-to-get-session-values-in-rails-2-3/161969>\
**Category:** Rails\
**Created:** [March 4, 2009, 12:01pm UTC](https://www.ruby-forum.com/t/how-to-get-session-values-in-rails-2-3/161969 "2009-03-04T12:01:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mokkai](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/c2a13f/32.png) [@mokkai](https://www.ruby-forum.com/u/mokkai)\
**Post date:** [March 4, 2009, 12:01pm UTC](https://www.ruby-forum.com/t/how-to-get-session-values-in-rails-2-3/161969/1 "2009-03-04T12:01:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mokkai](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/c2a13f/32.png) [@mokkai](https://www.ruby-forum.com/u/mokkai)\
**Post date:** [March 4, 2009, 12:11pm UTC](https://www.ruby-forum.com/t/how-to-get-session-values-in-rails-2-3/161969/2 "2009-03-04T12:11:53Z")

</div>

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](http://www.catb.org/~esr/faqs/smart-questions.html#urgent)

---

<div class="post-metadata">

**Author:** ![mokkai](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/c2a13f/32.png) [@mokkai](https://www.ruby-forum.com/u/mokkai)\
**Post date:** [March 4, 2009, 12:34pm UTC](https://www.ruby-forum.com/t/how-to-get-session-values-in-rails-2-3/161969/3 "2009-03-04T12:34:07Z")

</div>

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](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

> **[rails.info](http://guides.rails.info/2_3_release_notes.html#rack-based-lazy-loaded-sessions)**
>
> Ruby on Rails,Rails Tutorial,Ruby Basics,Rails 4,Bar Rails,Rail

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 ?
