Skip to content

Commit

Permalink
Modified per_page parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
kevindai2002 committed Oct 28, 2024
1 parent ed0c4d7 commit a8de1ff
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ def role

# For filtering the users list with proper search and pagination.
def paginate_list
paginate_options = { '1' => 25, '2' => 50, '3' => 100, '4' => User.count}
paginate_options = { '1' => 25, '2' => 50, '3' => 100, '4' => User.coun}

# If the above hash does not have a value for the key,
# it means that we need to show all the users on the page
Expand All @@ -259,7 +259,11 @@ def paginate_list

# The type of condition for the search depends on what the user has selected from the search_by dropdown
@search_by = params[:search_by]
@per_page = 4

# Sets the number of users to display per page based on the 'per_page' parameter from the request.
# If no 'per_page' parameter is provided, it defaults to '4', which corresponds to displaying all users on one page.
@per_page = params[:per_page] || '4'

# search for corresponding users
# users = User.search_users(role, user_id, letter, @search_by)

Expand Down

0 comments on commit a8de1ff

Please sign in to comment.