Skip to content

Commit

Permalink
Adds a scope for sorting groups.
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9947 e93f8b46-1217-0410-a6f0-8f06a7374b81
  • Loading branch information
jplang committed Jul 8, 2012
1 parent c11f5a2 commit 1c825df
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/groups_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions app/models/group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 1c825df

Please sign in to comment.