I set up session to save to the db and everytime I hit a page I get a new session entry created. Some of them have session_ids of more than 5 digits, but lots of them have session_ids like 0. Something is amiss.
on 2006-05-29 07:32
on 2006-05-29 17:08
I built a test application and get the same behavior. I cannot find any documentation of this bug so I assume I've done something wrong. I did follow the instructions in 'Agile Web Development with Rails' step by step though.
on 2006-05-29 17:14
can you paste the lines from environment.rb that you changed to put sessions in the DB ? How did you create your session table in the DB ? adam
on 2006-05-29 17:37
# Use the database for sessions instead of the file system # (create the session table with 'rake db:sessions:create') config.action_controller.session_store = :active_record_store class AddSessions < ActiveRecord::Migration def self.up create_table :sessions do |t| t.column :session_id, :string t.column :data, :text t.column :updated_at, :datetime end add_index :sessions, :session_id end def self.down drop_table :sessions end end
on 2006-05-29 18:02
Here is the code in my controller that gets called often to store a Score object to the session: private # Return the Score from this session, or create a new Score def find_score session[:score] ||= Score.new end Here is my Score object: class Score include Reloadable attr_reader :point_ids, :logged_test_id def initialize @point_ids =  @logged_test_id end def set_logged_test_id(logged_test_id) @logged_test_id = logged_test_id end def add_point_id(point_id) @point_ids << point_id end end