Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pagination options and RSpec tests for UserController #10

Merged
merged 10 commits into from
Oct 29, 2024
Next Next commit
add 4th paginate option to display all users
kevindai2002 committed Oct 27, 2024
commit ed0c4d7770824990c245e5c7ba030ebb9b95f086
4 changes: 2 additions & 2 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
@@ -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 }
paginate_options = { '1' => 25, '2' => 50, '3' => 100, '4' => User.count}

# 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
@@ -259,7 +259,7 @@ 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 = 3
@per_page = 4
# search for corresponding users
# users = User.search_users(role, user_id, letter, @search_by)