Adds a scope for sorting groups.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9947 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2012-07-08 07:40:31 +00:00
parent c11f5a23fe
commit 1c825df549
2 changed files with 3 additions and 1 deletions

View File

@ -25,7 +25,7 @@ class GroupsController < ApplicationController
helper :custom_fields helper :custom_fields
def index def index
@groups = Group.find(:all, :order => 'lastname') @groups = Group.sorted.all
respond_to do |format| respond_to do |format|
format.html format.html

View File

@ -29,6 +29,8 @@ class Group < Principal
before_destroy :remove_references_before_destroy before_destroy :remove_references_before_destroy
scope :sorted, order("#{table_name}.lastname ASC")
safe_attributes 'name', safe_attributes 'name',
'user_ids', 'user_ids',
'custom_field_values', 'custom_field_values',