diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2005-10-20 21:59:48 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2005-10-20 21:59:48 +0000 |
commit | 22d9bad8a038eef751e1270f204211cca3c8af18 (patch) | |
tree | 27064e135142b4f49f27b242ab98b409fe551e38 /actionpack/lib | |
parent | 5f0b9369cc857ef007a9b0f573b63225e342e4fd (diff) | |
download | rails-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')
-rwxr-xr-x | actionpack/lib/action_controller/base.rb | 4 | ||||
-rw-r--r-- | actionpack/lib/action_controller/session/active_record_store.rb | 15 |
2 files changed, 17 insertions, 2 deletions
diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb index 4cb8c11588..067dcacca6 100755 --- a/actionpack/lib/action_controller/base.rb +++ b/actionpack/lib/action_controller/base.rb @@ -4,6 +4,7 @@ require 'action_controller/routing' require 'action_controller/code_generation' require 'action_controller/url_rewriter' require 'drb' +require 'set' module ActionController #:nodoc: class ActionControllerError < StandardError #:nodoc: @@ -846,8 +847,7 @@ module ActionController #:nodoc: end def self.action_methods - #puts "action method: #{public_instance_methods.inspect}" - @action_methods ||= (public_instance_methods - hidden_actions).inject({}) { |h, k| h[k] = true; h } + @action_methods ||= Set.new(public_instance_methods - hidden_actions) end def add_variables_to_assigns 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 |