Sha256: f67c86cb895b4d8c61326ac7e30f465e5f48c303cbcfd635402c61f54681913a
Contents?: true
Size: 587 Bytes
Versions: 3
Compression:
Stored size: 587 Bytes
Contents
module Opay class Payment < ActiveRecord::Base belongs_to :payable, polymorphic: true attr_accessible :provider, :amount, :finished, :session_id, :status validates :payable, :provider, :amount, presence: true before_create do |p| p.session_id = Payment.generate_session_id end def self.generate_session_id # Generate a token by looping and ensuring does not already exist. loop do token = SecureRandom.base64(15).tr('+/=lIO0', 'pqrsxyz') break token unless Payment.where(session_id: token).first end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
opay-1.0.9 | app/models/opay/payment.rb |
opay-1.0.8 | app/models/opay/payment.rb |
opay-1.0.7 | app/models/opay/payment.rb |