Sha256: 087f807e1b2b5c57f34cae86fdfccc516e851c13f5663d86ee87d5bc4e39edbd
Contents?: true
Size: 457 Bytes
Versions: 66
Compression:
Stored size: 457 Bytes
Contents
module Spree module Core module TokenGenerator def generate_guest_token(model_class = Spree::Order) loop do token = "#{random_token}#{unique_ending}" break token unless model_class.exists?(guest_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
66 entries across 66 versions & 1 rubygems