Add scopes for invitations

This commit is contained in:
2020-12-03 14:04:58 +01:00
parent b8e75c7c4a
commit 8a7d809b92
2 changed files with 25 additions and 0 deletions

View File

@@ -6,6 +6,9 @@ class Invitation < ApplicationRecord
before_create :generate_token
scope :unused, -> { where(used_at: nil) }
scope :used, -> { where.not(used_at: nil) }
private
def generate_token