aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/session
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2005-10-20 21:59:48 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2005-10-20 21:59:48 +0000
commit22d9bad8a038eef751e1270f204211cca3c8af18 (patch)
tree27064e135142b4f49f27b242ab98b409fe551e38 /actionpack/lib/action_controller/session
parent5f0b9369cc857ef007a9b0f573b63225e342e4fd (diff)
downloadrails-22d9bad8a038eef751e1270f204211cca3c8af18.tar.gz
rails-22d9bad8a038eef751e1270f204211cca3c8af18.tar.bz2
rails-22d9bad8a038eef751e1270f204211cca3c8af18.zip
Expose the session model backing CGI::Session
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2696 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_controller/session')
-rw-r--r--actionpack/lib/action_controller/session/active_record_store.rb15
1 files changed, 15 insertions, 0 deletions
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