diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 0db7facbc..4049c2ae8 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -376,12 +376,13 @@ class UsersController < ApplicationController "show_changesets" => true } scope = User.logged.status(@status) - scope = scope.like(params[:name],params[:search_by][:id]) if params[:name].present? + @search_by = params[:search_by] ? params[:search_by][:id] : 0 + scope = scope.like(params[:name],@search_by) if params[:name].present? @user_count = scope.count @user_pages = Paginator.new @user_count, @limit, params['page'] @user_base_tag = params[:id] ? 'base_users':'users_base' @offset ||= @user_pages.reverse_offset - unless @offset == 0 + unless @offset == 0 @users = scope.offset(@offset).limit(@limit).all.reverse else limit = @user_count % @limit diff --git a/app/views/users/search.html.erb b/app/views/users/search.html.erb index f5bbc3b8d..f8d5a7cf3 100644 --- a/app/views/users/search.html.erb +++ b/app/views/users/search.html.erb @@ -20,8 +20,8 @@