Parent

Included Modules

Merb::DataMapperSessionStore

Public Class Methods

default_repository_name() click to toggle source
# 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) click to toggle source

Deletes a session with the given id

@param session_id<String> The session to destroy

# 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) click to toggle source

Retrieves a session from the session store

@param session_id<String> The session_id to retrieve the session for

@returns <nil, DataMapperSessionStore> The session corresponding to the id, or nil

# 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) click to toggle source

Stores the data in a session with the given session_id, creating it if required

@param session_id<String> The session_id to find the session by, or the id of the new session @param data<Object> The data to be stored in the session. Probably a hash

# 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

[Validate]

Generated with the Darkfish Rdoc Generator 2.