]> git.openstreetmap.org Git - rails.git/blob - vendor/plugins/sql_session_store/lib/sql_session.rb
Resyncing from head 10895:11795
[rails.git] / vendor / plugins / sql_session_store / lib / sql_session.rb
1 # An ActiveRecord class which corresponds to the database table\r
2 # +sessions+. Functions +find_session+, +create_session+,\r
3 # +update_session+ and +destroy+ constitute the interface to class\r
4 # +SqlSessionStore+.\r
5 \r
6 class SqlSession < ActiveRecord::Base\r
7   # this class should not be reloaded\r
8   def self.reloadable?\r
9     false\r
10   end\r
11 \r
12   # retrieve session data for a given +session_id+ from the database,\r
13   # return nil if no such session exists\r
14   def self.find_session(session_id)\r
15     find :first, :conditions => "session_id='#{session_id}'"\r
16   end\r
17 \r
18   # create a new session with given +session_id+ and +data+\r
19   def self.create_session(session_id, data)\r
20     new(:session_id => session_id, :data => data)\r
21   end\r
22 \r
23   # update session data and store it in the database\r
24   def update_session(data)\r
25     update_attribute('data', data)\r
26   end\r
27 end\r