class method self.generate_unique_secure_token

Ruby on Rails 6.1.7.10

Since v6.0.6

Available in: v6.0.6 v6.1.7.10 v7.0.10 v7.1.6 v7.2.3 v8.0.4 v8.1.2

Signature

self.generate_unique_secure_token(length: MINIMUM_TOKEN_LENGTH)

To prevent problems with case-insensitive filesystems, especially in combination with databases which treat indices as case-sensitive, all blob keys generated are going to only contain the base-36 character alphabet and will therefore be lowercase. To maintain the same or higher amount of entropy as in the base-58 encoding used by has_secure_token the number of bytes used is increased to 28 from the standard 24

Parameters

length key = MINIMUM_TOKEN_LENGTH
Source
# File activestorage/app/models/active_storage/blob.rb, line 135
    def generate_unique_secure_token(length: MINIMUM_TOKEN_LENGTH)
      SecureRandom.base36(length)
    end

Defined in activestorage/app/models/active_storage/blob.rb line 135 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveStorage::Blob

Type at least 2 characters to search.

↑↓ navigate · open · esc close