1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Session configuration in config/environment.rb instead of app/controllers/application.rb

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6198 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
Jeremy Kemper 2007-02-22 00:57:02 +00:00
parent 45dd256889
commit 5a1251dc2d
3 changed files with 9 additions and 7 deletions

View file

@ -81,6 +81,9 @@ module ActionController #:nodoc:
write_inheritable_array("session_options", [options])
end
# So we can declare session options in the Rails initializer.
alias_method :session=, :session
def cached_session_options #:nodoc:
@session_options ||= read_inheritable_attribute("session_options") || []
end

View file

@ -40,7 +40,11 @@ Rails::Initializer.run do |config|
# Make Active Record use UTC-base instead of local time
# config.active_record.default_timezone = :utc
# Your secret key for verifying cookie session data integrity.
# If you change this key, all old sessions will become invalid!
config.action_controller.session = { :secret => '<%= CGI::Session.generate_unique_id(app_name) %>' }
# See Rails::Configuration for more options
end
@ -57,4 +61,4 @@ end
# Mime::Type.register "text/richtext", :rtf
# Mime::Type.register "application/x-mobile", :mobile
# Include your application configuration below
# Include your application configuration below

View file

@ -2,9 +2,4 @@
# Likewise, all the methods added will be available for all controllers.
class ApplicationController < ActionController::Base
# Pick a unique cookie name to distinguish our session from others.
# Session data is stored in a cookie by default, so the data is hashed
# with a secret to ensure its integrity.
session :session_key => '_<%= app_name %>_session',
:secret => '<%= CGI::Session.generate_unique_id(app_name) %>'
end