# Session store active\_record\_store doesn't work

**URL:** <https://www.ruby-forum.com/t/session-store-active-record-store-doesnt-work/156644>\
**Category:** Rails\
**Created:** [December 31, 2008, 9:28am UTC](https://www.ruby-forum.com/t/session-store-active-record-store-doesnt-work/156644 "2008-12-31T09:28:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![k560](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/838e76/32.png) [@k560](https://www.ruby-forum.com/u/k560)\
**Post date:** [December 31, 2008, 9:28am UTC](https://www.ruby-forum.com/t/session-store-active-record-store-doesnt-work/156644/1 "2008-12-31T09:28:15Z")

</div>

I want to use acitive record store session.  
So I edited files like below.

\*environment.rb  
config.action\_controller.session\_store = :active\_record\_store

\*application.rb  
protect\_from\_forgery :secret =\> ‘54420ada…’

\*rake task  
rake db:sessions:create #successfully created

And controller and views like below

\*Controller  
class TestIndexController \< ApplicationController  
def index  
session[:test]=‘Test Value’  
…  
end  
end

\*Views  
test\_index/index.html.erb  
\<%=session[:test]%\> #=\>‘Test Value’

test\_index/new.html.erb  
\<%=session[:test]%\> #=\>nil\<==This is the problem!!

Session table creates session data certainly, but I can’t get  
session[:test]  
value except index action.  
Why?? Please give me advice!

PS:My environment is below.  
Rails 2.2.2  
ruby1.8.6  
gem 1.3.1  
Mac OS 10.5.5

–  
View this message in context:  
[http://www.nabble.com/session-store-active\_record\_store-doesn't-work.-tp21212439p21212439.html](http://www.nabble.com/session-store-active_record_store-doesn%27t-work.-tp21212439p21212439.html)  
Sent from the RubyOnRails Users mailing list archive at [Nabble.com](http://Nabble.com).
