aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2008-06-10 10:29:25 +0100
committerPratik Naik <pratiknaik@gmail.com>2008-06-10 10:29:25 +0100
commit19895f087c338d8385dff9d272d30fb87cb10330 (patch)
tree1e62a24023e74bc996a7e27ac8eb086814fd3f20 /actionpack
parent225065709c43dacd57e0904aef2075024ccf2744 (diff)
downloadrails-19895f087c338d8385dff9d272d30fb87cb10330.tar.gz
rails-19895f087c338d8385dff9d272d30fb87cb10330.tar.bz2
rails-19895f087c338d8385dff9d272d30fb87cb10330.zip
Lazy load cache and session stores
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_controller/session_management.rb9
-rw-r--r--actionpack/test/controller/caching_test.rb1
-rw-r--r--actionpack/test/controller/session/mem_cache_store_test.rb2
3 files changed, 4 insertions, 8 deletions
diff --git a/actionpack/lib/action_controller/session_management.rb b/actionpack/lib/action_controller/session_management.rb
index 80a3ddd2c5..ad1013b379 100644
--- a/actionpack/lib/action_controller/session_management.rb
+++ b/actionpack/lib/action_controller/session_management.rb
@@ -1,10 +1,3 @@
-require 'action_controller/session/cookie_store'
-require 'action_controller/session/drb_store'
-require 'action_controller/session/mem_cache_store'
-if Object.const_defined?(:ActiveRecord)
- require 'action_controller/session/active_record_store'
-end
-
module ActionController #:nodoc:
module SessionManagement #:nodoc:
def self.included(base)
@@ -22,6 +15,8 @@ module ActionController #:nodoc:
# <tt>:p_store</tt>, <tt>:drb_store</tt>, <tt>:mem_cache_store</tt>, or
# <tt>:memory_store</tt>) or your own custom class.
def session_store=(store)
+ require "action_controller/session/#{store.to_s}" if [:active_record_store, :drb_store, :mem_cache_store].include?(store)
+
ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS[:database_manager] =
store.is_a?(Symbol) ? CGI::Session.const_get(store == :drb_store ? "DRbStore" : store.to_s.camelize) : store
end
diff --git a/actionpack/test/controller/caching_test.rb b/actionpack/test/controller/caching_test.rb
index aee60b1c6f..4fb2397e5b 100644
--- a/actionpack/test/controller/caching_test.rb
+++ b/actionpack/test/controller/caching_test.rb
@@ -1,5 +1,6 @@
require 'fileutils'
require 'abstract_unit'
+require "active_support/cache/memory_store"
CACHE_DIR = 'test_cache'
# Don't change '/../temp/' cavalierly or you might hose something you don't want hosed
diff --git a/actionpack/test/controller/session/mem_cache_store_test.rb b/actionpack/test/controller/session/mem_cache_store_test.rb
index a7d48431f8..079a870ece 100644
--- a/actionpack/test/controller/session/mem_cache_store_test.rb
+++ b/actionpack/test/controller/session/mem_cache_store_test.rb
@@ -1,7 +1,7 @@
require 'abstract_unit'
require 'action_controller/cgi_process'
require 'action_controller/cgi_ext'
-
+require 'action_controller/session/mem_cache_store'
class CGI::Session
def cache