Show unused invitations list

This commit is contained in:
2020-12-03 14:48:43 +01:00
parent f7e48ad3a6
commit a792d66c90
4 changed files with 37 additions and 11 deletions

View File

@@ -2,10 +2,13 @@ class Invitation < ApplicationRecord
# Relations
belongs_to :user
# Validations
validates_presence_of :user
# Hooks
before_create :generate_token
# Scopes
scope :unused, -> { where(used_at: nil) }
scope :used, -> { where.not(used_at: nil) }