Project

paginary

0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Simple, view-based pagination for Rails, built on top of Active Record 3 awesomeness.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

~> 3.0
 Project Readme

Paginary – View-based pagination for Rails

Paginary is a simple plugin for Rails 3 that allows you to paginate in your views only. No need to touch your models or controllers.

Paginary is currently in beta status.

Getting started

Use fabulous pagination in just three simple steps!

1: Add Paginary to your Gemfile

In your Gemfile, add:

gem "paginary", "0.0.1.pre2"

2: Ensure your controllers return Relation objects

Make sure the controller actions that you wish to paginate return Active Record Relation objects. This means that you should avoid using .all.

This works:

# This is perfect:
@posts = Post.where(:status => "published")
@widgets = Widget.scoped

This does not work:

# This does not work; do not use .all, use .scoped instead:
@widgets = Widget.all

3: Add pagination helpers to your views

Something like this will do the trick:

<%= paginate @widgets do |page| -%>
  <%= page.links %>
  <ul>
    <% page.items.each do |widget| -%>
      <li><%= link_to widget.name, widget %></li>
    <% end -%>
  <ul>
<% end -%>

About Paginary

Paginary was created by Rolf Timmermans (r.timmermans at voormedia.com)

Copyright 2010-2011 Voormedia - www.voormedia.com

License

Paginary is released under the MIT license.