From bda0ca8188c19192e40b026a665fcb5b08d89a46 Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Mon, 23 Apr 2018 10:42:30 +0200 Subject: [PATCH] Service: sort services by name in index --- app/controllers/new_administrateur/services_controller.rb | 2 +- app/models/service.rb | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/new_administrateur/services_controller.rb b/app/controllers/new_administrateur/services_controller.rb index a4185cf88..6b1621786 100644 --- a/app/controllers/new_administrateur/services_controller.rb +++ b/app/controllers/new_administrateur/services_controller.rb @@ -1,7 +1,7 @@ module NewAdministrateur class ServicesController < AdministrateurController def index - @services = services + @services = services.ordered end private diff --git a/app/models/service.rb b/app/models/service.rb index f0f2c9111..0ea150b8a 100644 --- a/app/models/service.rb +++ b/app/models/service.rb @@ -2,6 +2,8 @@ class Service < ApplicationRecord has_many :procedures belongs_to :administrateur + scope :ordered, -> { order(nom: :asc) } + enum type_organisme: { administration_centrale: 'administration_centrale', association: 'association',