# Return the controller session secret for the current runtime environment.# Development and test environment secrets may optionally be hardcoded below.# For all other environments the secret must reside in the file config/session_secret.txt,# and that file should not be checked into the repository.classSetupExtensionsdefself.controller_session_secretbegin
secret =File.read(File.join(RAILS_ROOT, "config", "session_secret.txt"))
rescueErrno::ENOENT => e
raise e unless ['development','test'].include?(RAILS_ENV)
secret ='your_hardcoded_secret_string'end
secret
endendRails::Initializer.rundo |config|
...
config.action_controller.session= {
:session_key => '_your_session_id_',
:secret => SetupExtensions.controller_session_secret
}
end