backup_policy.rb 203 B

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