Class: Renalware::UsersController

Inherits:
BaseController show all
Includes:
Pagy::Backend
Defined in:
app/controllers/renalware/users_controller.rb

Instance Method Summary collapse

Methods inherited from BaseController

#patient

Instance Method Details

#indexObject



13
14
15
16
17
18
19
20
21
22
23
# File 'app/controllers/renalware/users_controller.rb', line 13

def index
  query = params.fetch(:q, {})
  query[:s] ||= "family_name"
  search = User
    .includes(:roles)
    .where.not(username: [:rwdev, :systemuser])
    .ransack(query)
  pagy, users = pagy(search.result(distinct: true))
  authorize users
  render locals: { users: users, pagy: pagy, user_search: search }
end