summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-07-08 07:40:31 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-07-08 07:40:31 +0000
commit1c825df5492938882310a9e7d4081401e9e63c37 (patch)
tree057461f4d4acde5a8c1341f51d4f812b12753c04 /app
parentc11f5a23fee248fe12236585c6638d104e8fd80d (diff)
downloadredmine-1c825df5492938882310a9e7d4081401e9e63c37.tar.gz
redmine-1c825df5492938882310a9e7d4081401e9e63c37.zip
Adds a scope for sorting groups.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9947 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r--app/controllers/groups_controller.rb2
-rw-r--r--app/models/group.rb2
2 files changed, 3 insertions, 1 deletions
diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb
index e1c13969d..244fa57b2 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 61266d97a..0eba591b5 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',