mirror of
https://github.com/meineerde/redmine.git
synced 2025-12-22 16:31:12 +00:00
Fixed group sorted scope order (#20066).
git-svn-id: http://svn.redmine.org/redmine/trunk@14380 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
27895ec8d2
commit
818e3fe01d
@ -32,7 +32,7 @@ class Group < Principal
|
||||
|
||||
before_destroy :remove_references_before_destroy
|
||||
|
||||
scope :sorted, lambda { order(:type => :asc, :lastname => :desc) }
|
||||
scope :sorted, lambda { order(:type => :asc, :lastname => :asc) }
|
||||
scope :named, lambda {|arg| where("LOWER(#{table_name}.lastname) = LOWER(?)", arg.to_s.strip)}
|
||||
scope :givable, lambda {where(:type => 'Group')}
|
||||
|
||||
|
||||
@ -158,4 +158,12 @@ class GroupTest < ActiveSupport::TestCase
|
||||
end
|
||||
assert_equal 0, group.reload.users.count
|
||||
end
|
||||
|
||||
def test_sorted_scope_should_sort_groups_alphabetically
|
||||
Group.delete_all
|
||||
b = Group.generate!(:name => 'B')
|
||||
a = Group.generate!(:name => 'A')
|
||||
|
||||
assert_equal %w(A B), Group.sorted.to_a.map(&:name)
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user