Sha256: fbc9c711e6215f3461fb5ebafe4d6af90de1c62e16b4c73fa07cdc6e3006e528
Contents?: true
Size: 445 Bytes
Versions: 102
Compression:
Stored size: 445 Bytes
Contents
module Spree module Core module TokenGenerator def generate_token(model_class = Spree::Order) loop do token = "#{random_token}#{unique_ending}" break token unless model_class.exists?(token: token) end end private def random_token SecureRandom.urlsafe_base64(nil, false) end def unique_ending (Time.now.to_f * 1000).to_i end end end end
Version data entries
102 entries across 102 versions & 1 rubygems