]> git.openstreetmap.org Git - rails.git/blob - vendor/plugins/sql_session_store/lib/sql_session.rb
fix menu issue spotted by randomjunk
[rails.git] / vendor / plugins / sql_session_store / lib / sql_session.rb
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
4 # +SqlSessionStore+.
5
6 class SqlSession < ActiveRecord::Base
7   # this class should not be reloaded
8   def self.reloadable?
9     false
10   end
11
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 }
16   end
17
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)
21   end
22
23   # update session data and store it in the database
24   def update_session(data)
25     update_attribute('data', data)
26   end
27 end