1 # An ActiveRecord class which corresponds to the database table
2 # +sessions+. Functions +find_session+, +create_session+,
3 # +update_session+ and +destroy+ constitute the interface to class
6 class SqlSession < ActiveRecord::Base
7 # this class should not be reloaded
12 # retrieve session data for a given +session_id+ from the database,
13 # return nil if no such session exists
14 def self.find_session(session_id)
15 find :first, :conditions => { :session_id => session_id }
18 # create a new session with given +session_id+ and +data+
19 def self.create_session(session_id, data)
20 new(:session_id => session_id, :data => data)
23 # update session data and store it in the database
24 def update_session(data)
25 update_attribute('data', data)