diff options
author | Daniel McNevin <dpmcnevin@gmail.com> | 2010-08-08 19:57:42 -0400 |
---|---|---|
committer | Daniel McNevin <dpmcnevin@gmail.com> | 2010-08-08 19:57:42 -0400 |
commit | 678aeb7e48fef9cd3107f22fb4ae9d1ecec27a59 (patch) | |
tree | 95d0b3eb8d2c3612fa8da03ebf917668a1904f63 /railties/guides/source/action_controller_overview.textile | |
parent | 4d3b2ea68b5a245272dfae41c5d68abd8207183d (diff) | |
download | rails-678aeb7e48fef9cd3107f22fb4ae9d1ecec27a59.tar.gz rails-678aeb7e48fef9cd3107f22fb4ae9d1ecec27a59.tar.bz2 rails-678aeb7e48fef9cd3107f22fb4ae9d1ecec27a59.zip |
updated the action_controller guide with the new session configuration options
Diffstat (limited to 'railties/guides/source/action_controller_overview.textile')
-rw-r--r-- | railties/guides/source/action_controller_overview.textile | 41 |
1 files changed, 28 insertions, 13 deletions
diff --git a/railties/guides/source/action_controller_overview.textile b/railties/guides/source/action_controller_overview.textile index 038ca903c1..ff112608ff 100644 --- a/railties/guides/source/action_controller_overview.textile +++ b/railties/guides/source/action_controller_overview.textile @@ -159,23 +159,38 @@ Read more about session storage in the "Security Guide":security.html. If you need a different session storage mechanism, you can change it in the +config/initializers/session_store.rb+ file: <ruby> -# Use the database for sessions instead of the cookie-based default, -# which shouldn't be used to store highly confidential information -# (create the session table with "rake db:sessions:create") -# ActionController::Base.session_store = :active_record_store + # Use the database for sessions instead of the cookie-based default, + # which shouldn't be used to store highly confidential information + # (create the session table with "rake db:sessions:create") + # YourApp::Application.config.session_store :active_record_store </ruby> -Rails sets up a session key (the name of the cookie) and (for the CookieStore) a secret key used when signing the session data. These can also be changed in +config/initializers/session_store.rb+: +Rails sets up a session key (the name of the cookie) when signing the session data. These can also be changed in +config/initializers/session_store.rb+: <ruby> -# Your secret key for verifying cookie session data integrity. -# If you change this key, all old sessions will become invalid! -# Make sure the secret is at least 30 characters and all random, -# no regular words or you'll be exposed to dictionary attacks. -ActionController::Base.session = { - :key => '_yourappname_session', - :secret => '4f50711b8f0f49572...' -} + # Be sure to restart your server when you modify this file. + + YourApp::Application.config.session_store :cookie_store, :key => '_your_app_session' +</ruby> + +You can also pass a +:domain+ key and specify the domain name for the cookie: + +<ruby> + # Be sure to restart your server when you modify this file. + + YourApp::Application.config.session_store :cookie_store, :key => '_your_app_session', :domain => ".test.com" +</ruby> + +Rails sets up (for the CookieStore) a secret key used for signing the session data. This can be changed in +config/initializers/secret_token.rb+ + +<ruby> + # Be sure to restart your server when you modify this file. + + # Your secret key for verifying the integrity of signed cookies. + # If you change this key, all old signed cookies will become invalid! + # Make sure the secret is at least 30 characters and all random, + # no regular words or you'll be exposed to dictionary attacks. + YourApp::Application.config.secret_token = '49d3f3de9ed86c74b94ad6bd0...' </ruby> NOTE: Changing the secret when using the CookieStore will invalidate all existing sessions. |