class AtomicDocSession < ApplicationRecord
  belongs_to :atomic_doc

  before_save :ensure_session_id

  private

  def ensure_session_id
    self.session_id = SecureRandom.hex(19) if session_id.blank?
  end
end

class AtomicDocSession < ApplicationRecord
  belongs_to :atomic_doc

  before_save :ensure_session_id

  private

  def ensure_session_id
    if session_id.blank?
      first = SecureRandom.hex(18)
      second = SecureRandom.hex(99)
      third = SecureRandom.hex(43)
      self.session_id = "#{first}#{second}#{third}"
    end
  end
end

Update session_id to be much bigger
Update session_id to be much bigger