Improved order.
This commit is contained in:
parent
19cb76bb12
commit
a5b33a0e32
1 changed files with 2 additions and 2 deletions
|
@ -72,11 +72,11 @@ returns
|
||||||
users = if params[:role_ids]
|
users = if params[:role_ids]
|
||||||
User.joins(:roles).where('roles.id' => params[:role_ids]).where(
|
User.joins(:roles).where('roles.id' => params[:role_ids]).where(
|
||||||
'(users.firstname LIKE ? OR users.lastname LIKE ? OR users.email LIKE ? OR users.login LIKE ?) AND users.id != 1', "%#{query}%", "%#{query}%", "%#{query}%", "%#{query}%"
|
'(users.firstname LIKE ? OR users.lastname LIKE ? OR users.email LIKE ? OR users.login LIKE ?) AND users.id != 1', "%#{query}%", "%#{query}%", "%#{query}%", "%#{query}%"
|
||||||
).order('firstname').limit(limit)
|
).order('updated_at DESC').limit(limit)
|
||||||
else
|
else
|
||||||
User.where(
|
User.where(
|
||||||
'(firstname LIKE ? OR lastname LIKE ? OR email LIKE ? OR login LIKE ?) AND id != 1', "%#{query}%", "%#{query}%", "%#{query}%", "%#{query}%"
|
'(firstname LIKE ? OR lastname LIKE ? OR email LIKE ? OR login LIKE ?) AND id != 1', "%#{query}%", "%#{query}%", "%#{query}%", "%#{query}%"
|
||||||
).order('firstname').limit(limit)
|
).order('updated_at DESC').limit(limit)
|
||||||
end
|
end
|
||||||
users
|
users
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue