X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/bed9cd00ed166ce346da4b8a9b654ddf86e64e70..2f3e23f6eb2bd571a39486773f0f10d65a2398a1:/vendor/plugins/sql_session_store/lib/sql_session.rb diff --git a/vendor/plugins/sql_session_store/lib/sql_session.rb b/vendor/plugins/sql_session_store/lib/sql_session.rb index 19d2ad51e..6db551753 100644 --- a/vendor/plugins/sql_session_store/lib/sql_session.rb +++ b/vendor/plugins/sql_session_store/lib/sql_session.rb @@ -1,27 +1,27 @@ -# An ActiveRecord class which corresponds to the database table -# +sessions+. Functions +find_session+, +create_session+, -# +update_session+ and +destroy+ constitute the interface to class -# +SqlSessionStore+. - -class SqlSession < ActiveRecord::Base - # this class should not be reloaded - def self.reloadable? - false - end - - # retrieve session data for a given +session_id+ from the database, - # return nil if no such session exists - def self.find_session(session_id) - find :first, :conditions => "session_id='#{session_id}'" - end - - # create a new session with given +session_id+ and +data+ - def self.create_session(session_id, data) - new(:session_id => session_id, :data => data) - end - - # update session data and store it in the database - def update_session(data) - update_attribute('data', data) - end -end +# An ActiveRecord class which corresponds to the database table +# +sessions+. Functions +find_session+, +create_session+, +# +update_session+ and +destroy+ constitute the interface to class +# +SqlSessionStore+. + +class SqlSession < ActiveRecord::Base + # this class should not be reloaded + def self.reloadable? + false + end + + # retrieve session data for a given +session_id+ from the database, + # return nil if no such session exists + def self.find_session(session_id) + find :first, :conditions => { :session_id => session_id } + end + + # create a new session with given +session_id+ and +data+ + def self.create_session(session_id, data) + new(:session_id => session_id, :data => data) + end + + # update session data and store it in the database + def update_session(data) + update_attribute('data', data) + end +end