A class for creating random secret keys. This class will do its best to create a random secret key that‘s as secure as possible, using whatever methods are available on the current platform. For example:

  generator = Rails::SecretKeyGenerator("some unique identifier, such as the application name")
  generator.generate_secret     # => "f3f1be90053fa851... (some long string)"

This class is deprecated in Rails 2.2 in favor of ActiveSupport::SecureRandom. It is currently a wrapper around ActiveSupport::SecureRandom.

Methods
Public Class methods
new(identifier)
    # File vendor/rails/railties/lib/rails_generator/secret_key_generator.rb, line 12
12:     def initialize(identifier)
13:     end
Public Instance methods
generate_secret()

Generate a random secret key with the best possible method available on the current platform.

    # File vendor/rails/railties/lib/rails_generator/secret_key_generator.rb, line 17
17:     def generate_secret
18:       ActiveSupport::SecureRandom.hex(64)
19:     end