diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index dc4b85fb4..b56fba5c2 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -2,13 +2,14 @@ class UsersController < ApplicationController before_filter :authenticate_user! def index - @search = current_organization.users.ransack(params[:q]) + @search = User.ransack(params[:q]) @search.sorts = 'members_member_uid asc' if @search.sorts.empty? @users = @search .result(distinct: false) .joins(members: :account) .eager_load(members: :account) + .where(members: { organization: current_organization.id }) .page(params[:page]) .per(25)