0.0
The project is in a healthy, maintained state
KaminariGuard is a gem that helps you detect missing paginate method calls in Kaminari, ensuring that your pagination works correctly.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 7.1.4
 Project Readme

⚡️kaminari_guard🛡️

kaminari_guard is a gem that helps you detect missing paginate method calls in kaminari, ensuring that your pagination works correctly.

Installation

Gemfile

group :development, :test do
  gem 'kaminari_guard'
end

Usage

In app/controllers/application_controller.rb

class ApplicationController < ActionController::Base
  kaminari_guard unless Rails.env.production?
end

In app/models/application_record.rb

class ApplicationRecord < ActiveRecord::Base
  kaminari_guard unless Rails.env.production?
end

Example

The following code will raise an exception.

class PostsController < ApplicationController
  def index
    @posts = Post.all.page(params[:page])
  end
end
<% if @posts.present? %>
  <% @posts.each do |post| %>
    <div><%= post.title %></div>
  <% end %>
  <!-- Forgot to call the `paginate` helper -->
<% else %>
  <div>No posts</div>
<% end %>

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the KaminariGuard project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.