Session active_record_store

I attempted to make a toy rails 2.3.5 application in Debian ‘squeeze’
that uses the database to store sessions.

My environment.rb is

require File.join(File.dirname(FILE), ‘boot’)

Rails::Initializer.run do |config|
config.action_controller.session_store = :active_record_store
config.time_zone = ‘UTC’
end

My routes.rb is

ActionController::Routing::Routes.draw do |map|
map.root(:controller => ‘application’)
end

My views consist of app/views/application/index.html.erb which
contains

Hello World <%= Time.zone.now %>

I removed public/index.html. I ran ‘rake db:sessions:create’ followed
by ‘rake db:migrate’ which created a table ‘sessions’ in the postgres
database ‘railsapp_development’.

The app starts without error and brings up the ‘Hello World’ page. It
doesn’t attempt to set a cookie and no row appears in the sessions
table.

What’s wrong?

Thanks

Nick

On Jun 11, 3:41 am, Nick [email protected] wrote:

The app starts without error and brings up the ‘Hello World’ page. It
doesn’t attempt to set a cookie and no row appears in the sessions
table.

What’s wrong?

Rails won’t create a session until you try and use one, which you
don’t appear to be doing

Fred

On 2010-06-11 01:19, Frederick C. wrote:

Rails won’t create a session until you try and use one, which you
don’t appear to be doing

How does one “use a session”?

Fred


Nick

u write in your controller
session[:blala]
if u not write it, u are not using session

Ivan N.
[email protected]

On 2010-06-11 16:50, Ivan N. wrote:

u write in your controller
session[:blala]

That worked, thanks.

Nick