diff options
author | Ryan Bigg <radarlistener@gmail.com> | 2008-10-01 21:38:16 +0930 |
---|---|---|
committer | Ryan Bigg <radarlistener@gmail.com> | 2008-10-01 21:38:16 +0930 |
commit | dbbd757edd896947e33fdf18ba870b8df5974d62 (patch) | |
tree | cc0428bee430a18200925acb830f3dc3946e31de /actionpack/lib/action_controller/cgi_ext/session.rb | |
parent | 6aca4458e3a1712a4a675ee7bf2cd35701ff75c9 (diff) | |
parent | 8292c7dfce4b893588860053e50ef60ae9a0609a (diff) | |
download | rails-dbbd757edd896947e33fdf18ba870b8df5974d62.tar.gz rails-dbbd757edd896947e33fdf18ba870b8df5974d62.tar.bz2 rails-dbbd757edd896947e33fdf18ba870b8df5974d62.zip |
Merge branch 'master' of git@github.com:lifo/docrails
Diffstat (limited to 'actionpack/lib/action_controller/cgi_ext/session.rb')
-rw-r--r-- | actionpack/lib/action_controller/cgi_ext/session.rb | 24 |
1 files changed, 2 insertions, 22 deletions
diff --git a/actionpack/lib/action_controller/cgi_ext/session.rb b/actionpack/lib/action_controller/cgi_ext/session.rb index a01f17f9ce..d3f85e3705 100644 --- a/actionpack/lib/action_controller/cgi_ext/session.rb +++ b/actionpack/lib/action_controller/cgi_ext/session.rb @@ -6,28 +6,8 @@ class CGI #:nodoc: # * Expose the CGI instance to session stores. # * Don't require 'digest/md5' whenever a new session id is generated. class Session #:nodoc: - begin - require 'securerandom' - - # Generate a 32-character unique id using SecureRandom. - # This is used to generate session ids but may be reused elsewhere. - def self.generate_unique_id(constant = nil) - SecureRandom.hex(16) - end - rescue LoadError - # Generate an 32-character unique id based on a hash of the current time, - # a random number, the process id, and a constant string. This is used - # to generate session ids but may be reused elsewhere. - def self.generate_unique_id(constant = 'foobar') - md5 = Digest::MD5.new - now = Time.now - md5 << now.to_s - md5 << String(now.usec) - md5 << String(rand(0)) - md5 << String($$) - md5 << constant - md5.hexdigest - end + def self.generate_unique_id(constant = nil) + ActiveSupport::SecureRandom.hex(16) end # Make the CGI instance available to session stores. |