Updated all current Models to include Pagination for index views.

This commit is contained in:
Ben 2024-01-30 00:04:20 -06:00
parent d5e19f561e
commit 66aaeb4ed6
7 changed files with 8 additions and 5 deletions

View File

@ -3,7 +3,7 @@ class EmployersController < ApplicationController
# GET /employers
def index
@employers = Employer.order(:last_name)
@employers = Employer.order(:last_name).page(params[:page]).per(5) # Adjust the number per page as needed
end
# GET /employers/:id

View File

@ -3,7 +3,6 @@ class ParticipantsController < ApplicationController
def index
@participants = Participant.order(:last_name).page(params[:page]).per(5) # Adjust the number per page as needed
end

View File

@ -1,6 +1,6 @@
class VendorsController < ApplicationController
def index
@vendors = Vendor.all
@vendors = Vendor.order(:name).page(params[:page]).per(5) # Adjust the number per page as needed
end
def show

View File

@ -1,6 +1,6 @@
class WorkersController < ApplicationController
def index
@workers = Worker.all
@workers = Worker.order(:last_name).page(params[:page]).per(5) # Adjust the number per page as needed
end
def show

View File

@ -5,7 +5,7 @@
<%= link_to 'New Employer', new_employer_path, class: 'btn btn-dark mb-3' %>
</div>
<%= paginate @employers %>
<table class="table table-striped table-hover">
<thead class="table-light">

View File

@ -5,6 +5,8 @@
<%= link_to 'New Vendor', new_vendor_path, class: 'btn btn-dark mb-3' %>
</div>
<%= paginate @vendors %>
<table class="table table-striped table-hover">
<thead class="table-light">
<tr>

View File

@ -5,6 +5,8 @@
<%= link_to 'New Worker', new_worker_path, class: 'btn btn-dark mb-3' %>
</div>
<%= paginate @workers %>
<table class="table table-striped table-hover">
<thead class="table-light">
<tr>