Skip to content
This repository
Browse code

Added ActionController::Base.session_store=, session_store, and sessi…

…on_options to make it easier to tweak the session options (instead of going straight to ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS)

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2228 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit 53ee2c96337d16be9a86710d8179941d16895b98 1 parent 426fa08
David Heinemeier Hansson authored September 13, 2005
2  actionpack/CHANGELOG
... ...
@@ -1,5 +1,7 @@
1 1
 *SVN*
2 2
 
  3
+* Added ActionController::Base.session_store=, session_store, and session_options to make it easier to tweak the session options (instead of going straight to ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS)
  4
+
3 5
 * Added TextHelper#cycle to cycle over an array of values on each hit (useful for alternating row colors etc) #2154 [dave-ml@dribin.org]
4 6
 
5 7
 * Ensure that request.path never returns nil. Closes #1675 [Nicholas Seckar]
20  actionpack/lib/action_controller/base.rb
@@ -346,6 +346,26 @@ def enable_upload_progress # :nodoc:
346 346
         require 'action_controller/upload_progress'
347 347
         include ActionController::UploadProgress
348 348
       end
  349
+
  350
+      # Set the session store to be used for keeping the session data between requests. The default is using the
  351
+      # file system, but you can also specify one of the other included stores (:active_record_store, :drb_store, 
  352
+      # :mem_cache_store, or :memory_store) or use your own class.
  353
+      def session_store=(store)
  354
+        ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS[:database_manager] =
  355
+          store.is_a?(Symbol) ? CGI::Session.const_get(store.to_s.camelize) : store
  356
+      end
  357
+
  358
+      # Returns the session store class currently used.
  359
+      def session_store
  360
+        ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS[:database_manager]
  361
+      end
  362
+
  363
+      # Returns the hash used to configure the session. Example use:
  364
+      #
  365
+      #   ActionController::Base.session_options[:session_secure] = true # session only available over HTTPS
  366
+      def session_options
  367
+        ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS
  368
+      end
349 369
     end
350 370
 
351 371
     public
2  actionpack/test/template/javascript_helper_test.rb
@@ -42,7 +42,7 @@ def test_link_to_remote
42 42
   end
43 43
   
44 44
   def test_periodically_call_remote
45  
-    assert_equal %(<script>new PeriodicalExecuter(function() {new Ajax.Updater('schremser_bier', 'http://www.example.com/mehr_bier', {asynchronous:true, evalScripts:true})}, 10)</script>),
  45
+    assert_equal %(<script type="text/javascript">new PeriodicalExecuter(function() {new Ajax.Updater('schremser_bier', 'http://www.example.com/mehr_bier', {asynchronous:true, evalScripts:true})}, 10)</script>),
46 46
       periodically_call_remote(:update => "schremser_bier", :url => { :action => "mehr_bier" })
47 47
   end
48 48
   

0 notes on commit 53ee2c9

Please sign in to comment.
Something went wrong with that request. Please try again.