Improve the formatting of the Procedure scopes

This commit is contained in:
gregoirenovel 2017-07-11 15:57:12 +02:00
parent 2f4f10683f
commit c43f3fa415

View file

@ -32,11 +32,11 @@ class Procedure < ActiveRecord::Base
mount_uploader :logo, ProcedureLogoUploader
default_scope { where(hidden_at: nil) }
scope :brouillons, -> { where(published_at: nil).where(archived_at: nil) }
scope :publiees, -> { where.not(published_at: nil).where(archived_at: nil) }
scope :archivees, -> { where.not(archived_at: nil) }
scope :brouillons, -> { where(published_at: nil).where(archived_at: nil) }
scope :publiees, -> { where.not(published_at: nil).where(archived_at: nil) }
scope :archivees, -> { where.not(archived_at: nil) }
scope :publiee_ou_archivee, -> { where.not(published_at: nil) }
scope :by_libelle, -> { order(libelle: :asc) }
scope :by_libelle, -> { order(libelle: :asc) }
validates :libelle, presence: true, allow_blank: false, allow_nil: false
validates :description, presence: true, allow_blank: false, allow_nil: false