Module: Spree::Core::TokenGenerator
- Included in:
- ControllerHelpers::Auth
- Defined in:
- lib/spree/core/token_generator.rb
Instance Method Summary collapse
Instance Method Details
#generate_token(model_class = Spree::Order) ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/spree/core/token_generator.rb', line 4 def generate_token(model_class = Spree::Order) Spree::Deprecation.warn('generate_token is deprecated and will be removed in Spree 6.0. Please use Rails secure token generator: https://api.rubyonrails.org/classes/ActiveRecord/SecureToken/ClassMethods.html') loop do token = "#{random_token}#{unique_ending}" break token unless model_class.exists?(token: token) end end |