backup_policy.rb 208 B

123456789
  1. # frozen_string_literal: true
  2. class BackupPolicy < ApplicationPolicy
  3. MIN_AGE = 1.week
  4. def create?
  5. user_signed_in? && current_user.backups.where('created_at >= ?', MIN_AGE.ago).count.zero?
  6. end
  7. end