Sha256: 6b06b771cc282bb8ba0ea298ad92e4dd8be0cb34b63a8898b5919e3fa5fd74e2
Contents?: true
Size: 507 Bytes
Versions: 9
Compression:
Stored size: 507 Bytes
Contents
# frozen_string_literal: true class Invite < ApplicationRecord include PagesCore::HasRoles belongs_to :user has_many :roles, class_name: "InviteRole", dependent: :destroy before_validation :ensure_token validates :email, presence: true, format: { with: /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i }, uniqueness: { case_sensitive: false } validates :token, presence: true private def ensure_token self.token ||= SecureRandom.hex(32) end end
Version data entries
9 entries across 9 versions & 1 rubygems