class UsersForPrivateMessagesController < ApplicationController before_action :require_login, :check_auth def index users = User.active.where.not(id: current_user.id) keyword = params[:keyword].to_s.strip if keyword.blank? @users = [] return end users = users.where('LOWER(concat(lastname, firstname, nickname)) LIKE ?', "%#{keyword}%") @users = users.limit(10).includes(:user_extension) end end