aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-09-13 07:46:57 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-09-13 07:46:57 +0000
commit53ee2c96337d16be9a86710d8179941d16895b98 (patch)
treea8349b33cc31d94a867d182f0a96a60d80494948 /actionpack
parent426fa08cc03b5dc65915a648c26a1b139314d54e (diff)
downloadrails-53ee2c96337d16be9a86710d8179941d16895b98.tar.gz
rails-53ee2c96337d16be9a86710d8179941d16895b98.tar.bz2
rails-53ee2c96337d16be9a86710d8179941d16895b98.zip
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)
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2228 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/CHANGELOG2
-rwxr-xr-xactionpack/lib/action_controller/base.rb20
-rw-r--r--actionpack/test/template/javascript_helper_test.rb2
3 files changed, 23 insertions, 1 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG
index 16d70e5bf7..a3cd28bf4b 100644
--- a/actionpack/CHANGELOG
+++ b/actionpack/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* 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)
+
* Added TextHelper#cycle to cycle over an array of values on each hit (useful for alternating row colors etc) #2154 [dave-ml@dribin.org]
* Ensure that request.path never returns nil. Closes #1675 [Nicholas Seckar]
diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb
index 59160c3e81..0bfa261e7a 100755
--- a/actionpack/lib/action_controller/base.rb
+++ b/actionpack/lib/action_controller/base.rb
@@ -346,6 +346,26 @@ module ActionController #:nodoc:
require 'action_controller/upload_progress'
include ActionController::UploadProgress
end
+
+ # Set the session store to be used for keeping the session data between requests. The default is using the
+ # file system, but you can also specify one of the other included stores (:active_record_store, :drb_store,
+ # :mem_cache_store, or :memory_store) or use your own class.
+ def session_store=(store)
+ ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS[:database_manager] =
+ store.is_a?(Symbol) ? CGI::Session.const_get(store.to_s.camelize) : store
+ end
+
+ # Returns the session store class currently used.
+ def session_store
+ ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS[:database_manager]
+ end
+
+ # Returns the hash used to configure the session. Example use:
+ #
+ # ActionController::Base.session_options[:session_secure] = true # session only available over HTTPS
+ def session_options
+ ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS
+ end
end
public
diff --git a/actionpack/test/template/javascript_helper_test.rb b/actionpack/test/template/javascript_helper_test.rb
index bf0f6ac5aa..c3d68b75bf 100644
--- a/actionpack/test/template/javascript_helper_test.rb
+++ b/actionpack/test/template/javascript_helper_test.rb
@@ -42,7 +42,7 @@ class JavaScriptHelperTest < Test::Unit::TestCase
end
def test_periodically_call_remote
- assert_equal %(<script>new PeriodicalExecuter(function() {new Ajax.Updater('schremser_bier', 'http://www.example.com/mehr_bier', {asynchronous:true, evalScripts:true})}, 10)</script>),
+ 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>),
periodically_call_remote(:update => "schremser_bier", :url => { :action => "mehr_bier" })
end