0.0
No release in over 3 years
Simple pagination plugin
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 8.0.2
~> 0.22.0

Runtime

>= 8.0.3
 Project Readme

tiny_paginate

License: MIT Gem Version

tiny_paginate is a lightweight and easy-to-use pagination gem for Ruby on Rails. Designed for simplicity and minimal overhead, it provides basic pagination functionality with clean helpers and minimal configuration—perfect for small projects or developers who want to avoid the complexity of larger pagination libraries.

Usage

tiny_paginate is simple to use. Follow the steps below to install and use it.

Installation

Add this line to your application's Gemfile:

gem "tiny_paginate"

And then execute:

$ bundle

Or install it yourself as:

$ gem install tiny_paginate

To work with this gem in your application, execute the following command:

$ rails g tiny_paginate:install

Modify controller

Here, we'll add the following line to setup page instance variable and extract portion of the records:

@recordings = set_page_and_extract_portion_from(collection: Recording.all)

set_page_and_extract_partion returns records and also @page instance variable which is available to the views

Modify the view

In the page where you want to display the records, paste the following entries, assumming that you have a model called recording:

<p>
  <%= link_to("Previous Page", recordings_path(page: @page.previous_page)) unless @page.first_page? %>
  <%= link_to("Next Page", recordings_path(page: @page.next_page)) unless @page.last_page? %>
</p>  

Change settings

Upon installation, a tiny_paginate.rb file is created with a single configuration option: max_records_per_page, which defaults to 30. You can easily modify this value to suit the needs of your application.

Update

After installation, you can use the most recent version of tiny_paginate by running the following commands:

$ bundle update --conservative tiny_paginate

and then execute:

$ rails g tiny_paginate:install

Continue to update the controller and view if you've not done so already.

Contributing

  • Close the Repo
  • Create a branch with the changes you desire
  • Create a PR against the main branch

PR will be approved and merged upon review by the repo gem owner.

License

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