use discard

This commit is contained in:
Paul Chavard 2020-02-05 16:09:03 +01:00
parent 674c24c4f7
commit 1ce1c1e6d0
16 changed files with 41 additions and 69 deletions

View file

@ -16,5 +16,7 @@ class Invite < ApplicationRecord
# and Dossier from their respective `default_scope`s.
# Therefore, we also remove `Invite`s for such effectively deleted `Dossier`s
# from their default scope.
default_scope { joins(:dossier).where(dossiers: { hidden_at: nil }) }
scope :kept, -> { joins(:dossier).merge(Dossier.kept) }
default_scope { kept }
end