aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/middleware/session/abstract_store.rb
diff options
context:
space:
mode:
authorAditya Chadha <aditya@sublucid.com>2009-05-02 18:32:45 -0400
committerAditya Chadha <aditya@sublucid.com>2009-05-02 18:32:45 -0400
commit7a17ad3f2b89baea94450af8e63a640ace570938 (patch)
tree89cd60c05d4a812b3c8636373a05689b1df5bf75 /actionpack/lib/action_dispatch/middleware/session/abstract_store.rb
parent5469a0be1a517a0c2d8ee553b704df4e6f7df306 (diff)
parent1b32f882091ed7744654f74238f3f3b1ba6701ae (diff)
downloadrails-7a17ad3f2b89baea94450af8e63a640ace570938.tar.gz
rails-7a17ad3f2b89baea94450af8e63a640ace570938.tar.bz2
rails-7a17ad3f2b89baea94450af8e63a640ace570938.zip
Merge branch 'master' of git@github.com:lifo/docrails
Diffstat (limited to 'actionpack/lib/action_dispatch/middleware/session/abstract_store.rb')
-rw-r--r--actionpack/lib/action_dispatch/middleware/session/abstract_store.rb30
1 files changed, 26 insertions, 4 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/session/abstract_store.rb b/actionpack/lib/action_dispatch/middleware/session/abstract_store.rb
index 6c039cf62d..03761b10bd 100644
--- a/actionpack/lib/action_dispatch/middleware/session/abstract_store.rb
+++ b/actionpack/lib/action_dispatch/middleware/session/abstract_store.rb
@@ -26,12 +26,12 @@ module ActionDispatch
def [](key)
load! unless @loaded
- super
+ super(key.to_s)
end
def []=(key, value)
load! unless @loaded
- super
+ super(key.to_s, value)
end
def to_hash
@@ -40,6 +40,24 @@ module ActionDispatch
h
end
+ def update(hash = nil)
+ if hash.nil?
+ ActiveSupport::Deprecation.warn('use replace instead', caller)
+ replace({})
+ else
+ super(hash.stringify_keys)
+ end
+ end
+
+ def delete(key = nil)
+ if key.nil?
+ ActiveSupport::Deprecation.warn('use clear instead', caller)
+ clear
+ else
+ super(key.to_s)
+ end
+ end
+
def data
ActiveSupport::Deprecation.warn(
"ActionController::Session::AbstractStore::SessionHash#data " +
@@ -47,6 +65,10 @@ module ActionDispatch
to_hash
end
+ def close
+ ActiveSupport::Deprecation.warn('sessions should no longer be closed', caller)
+ end
+
def inspect
load! unless @loaded
super
@@ -61,7 +83,7 @@ module ActionDispatch
stale_session_check! do
id, session = @by.send(:load_session, @env)
(@env[ENV_SESSION_OPTIONS_KEY] ||= {})[:id] = id
- replace(session)
+ replace(session.stringify_keys)
@loaded = true
end
end
@@ -74,7 +96,7 @@ module ActionDispatch
# Note that the regexp does not allow $1 to end with a ':'
$1.constantize
rescue LoadError, NameError => const_error
- raise ActionController::SessionRestoreError, "Session contains objects whose class definition isn\\'t available.\nRemember to require the classes for all objects kept in the session.\n(Original exception: \#{const_error.message} [\#{const_error.class}])\n"
+ raise ActionController::SessionRestoreError, "Session contains objects whose class definition isn't available.\nRemember to require the classes for all objects kept in the session.\n(Original exception: #{const_error.message} [#{const_error.class}])\n"
end
retry