#73 Pagination with Kaminari

Summary

When displaying a significant number of records, it is often a basic functions in a web application is to paginate the records and load them as requested.
rails view 2:37

Resources

Summary

# Gemfile
gem 'kaminari'

# Terminal
# Generate the kaminari config
rails g kaminari:config

# Generate kaminari views
rails g kaminari:views bootstrap3

# users_controller.rb
  def index
    @users = User.order(:last_name).page(params[:page])
  end

# index.html.erb
<%= paginate @users %>

# user.rb
class User < ApplicationRecord
  paginates_per 5
end