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',