Define .brouillon as a scope and remove archived=false filter
This commit is contained in:
parent
21a2a5402b
commit
688a3d8f31
2 changed files with 7 additions and 7 deletions
|
@ -16,7 +16,7 @@ class Users::DossiersController < UsersController
|
|||
|
||||
@dossiers_filtered = case @liste
|
||||
when 'brouillon'
|
||||
@user_dossiers.brouillon
|
||||
@user_dossiers.brouillon.order_by_updated_at
|
||||
when 'a_traiter'
|
||||
@user_dossiers.en_construction
|
||||
when 'en_instruction'
|
||||
|
|
|
@ -157,18 +157,18 @@ class Dossier < ActiveRecord::Base
|
|||
state
|
||||
end
|
||||
|
||||
def brouillon?
|
||||
BROUILLON.include?(state)
|
||||
end
|
||||
|
||||
def self.all_state order = 'ASC'
|
||||
where(state: ALL_STATE, archived: false).order("updated_at #{order}")
|
||||
end
|
||||
|
||||
def self.brouillon order = 'ASC'
|
||||
where(state: BROUILLON, archived: false).order("updated_at #{order}")
|
||||
def brouillon?
|
||||
BROUILLON.include?(state)
|
||||
end
|
||||
|
||||
scope :brouillon, -> { where(state: BROUILLON) }
|
||||
|
||||
scope :order_by_updated_at, -> (order = :desc) { order(updated_at: order) }
|
||||
|
||||
def self.nouveaux order = 'ASC'
|
||||
where(state: NOUVEAUX, archived: false).order("updated_at #{order}")
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue