Added order for User.of_role().
This commit is contained in:
parent
d31daac4ef
commit
2cb31d20a7
1 changed files with 2 additions and 2 deletions
|
@ -460,12 +460,12 @@ returns
|
||||||
def self.of_role(role, group_ids = nil)
|
def self.of_role(role, group_ids = nil)
|
||||||
roles_ids = Role.where(active: true, name: role).map(&:id)
|
roles_ids = Role.where(active: true, name: role).map(&:id)
|
||||||
if !group_ids
|
if !group_ids
|
||||||
return User.where(active: true).joins(:users_roles).where('roles_users.role_id IN (?)', roles_ids)
|
return User.where(active: true).joins(:users_roles).where('roles_users.role_id IN (?)', roles_ids).order('users.updated_at DESC')
|
||||||
end
|
end
|
||||||
User.where(active: true)
|
User.where(active: true)
|
||||||
.joins(:users_roles)
|
.joins(:users_roles)
|
||||||
.joins(:users_groups)
|
.joins(:users_groups)
|
||||||
.where('roles_users.role_id IN (?) AND users_groups.group_ids IN (?)', roles_ids, group_ids)
|
.where('roles_users.role_id IN (?) AND users_groups.group_ids IN (?)', roles_ids, group_ids).order('users.updated_at DESC')
|
||||||
end
|
end
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
|
Loading…
Reference in a new issue