Skip to content

Added pagination - #182

Merged
eelcoj merged 2 commits into
mainfrom
pagination
Jun 3, 2026
Merged

Added pagination#182
eelcoj merged 2 commits into
mainfrom
pagination

Conversation

@eelcoj

@eelcoj eelcoj commented Apr 6, 2026

Copy link
Copy Markdown
Contributor

Usage:

class Content::Post < Perron::Resource
  configure do |config|
    config.pagination.per_page = 10
  end
end
class Content::PostsController < ApplicationController
  include Perron::PaginateHelper

  def index
    @paginate, @resources = paginate(Content::Post.all)
  end
end
<%# app/views/content/posts/index.html.erb %>
<%= link_to "Previous", @paginate.previous if @paginate.previous? %>
<%= link_to "Next", @paginate.next if @paginate.next? %>

Not 100% happy with the API yet—but pretty close for basic pagination. This design should also make it easy to extend with “pagination groupings”, eg. by year/month/day.

Closes #63

eelcoj added 2 commits March 27, 2026 12:48
Usage:

```
class Content::Post < Perron::Resource
  configure do |config|
    config.pagination.per_page = 10
  end
end
```
```
class Content::PostsController < ApplicationController
  include Perron::PaginateHelper

  def index
    @paginate, @resources = paginate(Content::Post, Content::Post.all)
  end
end
```

```
<%# app/views/content/posts/index.html.erb %>
<%= link_to "Previous", @paginate.previous if @paginate.previous? %>
<%= link_to "Next", @paginate.next if @paginate.next? %>
```
@eelcoj
eelcoj merged commit 58d643e into main Jun 3, 2026
0 of 3 checks passed
@eelcoj
eelcoj deleted the pagination branch June 3, 2026 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pagination

1 participant