From 1c825df5492938882310a9e7d4081401e9e63c37 2012-07-08 07:40:31 From: Jean-Philippe Lang Date: 2012-07-08 07:40:31 Subject: [PATCH] Adds a scope for sorting groups. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9947 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index e1c1396..244fa57 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -25,7 +25,7 @@ class GroupsController < ApplicationController helper :custom_fields def index - @groups = Group.find(:all, :order => 'lastname') + @groups = Group.sorted.all respond_to do |format| format.html diff --git a/app/models/group.rb b/app/models/group.rb index 61266d9..0eba591 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -29,6 +29,8 @@ class Group < Principal before_destroy :remove_references_before_destroy + scope :sorted, order("#{table_name}.lastname ASC") + safe_attributes 'name', 'user_ids', 'custom_field_values',