models: add a Dossier#with_hidden scope, and remove unscoped
usages
This commit is contained in:
parent
1448d5b098
commit
96932faa3f
10 changed files with 39 additions and 19 deletions
|
@ -95,6 +95,8 @@ class Dossier < ApplicationRecord
|
|||
end
|
||||
|
||||
default_scope { where(hidden_at: nil) }
|
||||
scope :hidden, -> { unscope(where: :hidden_at).where.not(hidden_at: nil) }
|
||||
scope :with_hidden, -> { unscope(where: :hidden_at) }
|
||||
scope :state_brouillon, -> { where(state: states.fetch(:brouillon)) }
|
||||
scope :state_not_brouillon, -> { where.not(state: states.fetch(:brouillon)) }
|
||||
scope :state_en_construction, -> { where(state: states.fetch(:en_construction)) }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue