Module: Spree::Core::TokenGenerator

Included in:
ControllerHelpers::Auth, Order
Defined in:
lib/spree/core/token_generator.rb

Instance Method Summary collapse

Instance Method Details

#generate_guest_token(model_class = Spree::Order) ⇒ Object


4
5
6
7
8
9
# File 'lib/spree/core/token_generator.rb', line 4

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