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. -- Posted via http://www.ruby-forum.com/.
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. -- Posted via http://www.ruby-forum.com/.
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 5/29/06, Will Merydith <will.merydith@gmail.com> wrote:> > 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. > > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060529/3f789db3/attachment.html
# 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
--
Posted via http://www.ruby-forum.com/.
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
--
Posted via http://www.ruby-forum.com/.