From 22d9bad8a038eef751e1270f204211cca3c8af18 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Thu, 20 Oct 2005 21:59:48 +0000 Subject: Expose the session model backing CGI::Session git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2696 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- .../lib/action_controller/session/active_record_store.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'actionpack/lib/action_controller/session') diff --git a/actionpack/lib/action_controller/session/active_record_store.rb b/actionpack/lib/action_controller/session/active_record_store.rb index a653947038..90a84511be 100644 --- a/actionpack/lib/action_controller/session/active_record_store.rb +++ b/actionpack/lib/action_controller/session/active_record_store.rb @@ -5,6 +5,16 @@ require 'base64' class CGI class Session + # Return this session's underlying Session model. Useful for the DB-backed session stores. + def model + @dbman.model rescue nil + end + + # Proxy missing methods to the underlying Session model. + def method_missing(method, *args, &block) + if model then model.send(method, *args, &block) else super end + end + # A session store backed by an Active Record class. # # A default class is provided, but any object duck-typing to an Active @@ -277,6 +287,11 @@ class CGI end end + # Access the underlying session model. + def model + @session + end + # Restore session state. The session model handles unmarshaling. def restore if @session -- cgit v1.2.3