Class: Merb::DataMapperSessionStore
- Inherits:
-
Object
- Object
- Merb::DataMapperSessionStore
- Includes:
- DataMapper::Resource
- Defined in:
- lib/merb_datamapper/data_mapper_session.rb
Class Method Summary collapse
- .default_repository_name ⇒ Object
-
.delete_session(session_id) ⇒ Object
Deletes a session with the given id.
-
.retrieve_session(session_id) ⇒ Object
Retrieves a session from the session store.
-
.store_session(session_id, data) ⇒ Object
Stores the data in a session with the given session_id, creating it if required.
Class Method Details
.default_repository_name ⇒ Object
7 8 9 |
# File 'lib/merb_datamapper/data_mapper_session.rb', line 7 def self.default_repository_name Merb::Plugins.config[:merb_datamapper][:session_repository_name] end |
.delete_session(session_id) ⇒ Object
Deletes a session with the given id
47 48 49 |
# File 'lib/merb_datamapper/data_mapper_session.rb', line 47 def self.delete_session(session_id) all(:session_id => session_id).destroy! end |
.retrieve_session(session_id) ⇒ Object
Retrieves a session from the session store
23 24 25 26 27 |
# File 'lib/merb_datamapper/data_mapper_session.rb', line 23 def self.retrieve_session(session_id) if session = get(session_id) session.data end end |
.store_session(session_id, data) ⇒ Object
Stores the data in a session with the given session_id, creating it if required
35 36 37 38 39 40 41 |
# File 'lib/merb_datamapper/data_mapper_session.rb', line 35 def self.store_session(session_id, data) if session = get(session_id) session.update(:data => data) else create(:session_id => session_id, :data => data) end end |