Questions tagged [will-paginate]

Ruby pagination library

A pagination library for Ruby that integrates with popular web frameworks and database drivers. See the will_paginate documentation.

859 questions
8
votes
1 answer

Rails: Prevent will_paginate from calling #count of ActiveRelation

When I pass will_paginate an ActiveRelation, it always calls its #count method and hits the database to find out the total number of items. But this operation takes time and I have the total number already cached and ready. Can I pass this…
sina
  • 960
  • 2
  • 8
  • 20
8
votes
3 answers

How to render two paginated and ajaxable collections in the same view?

In a Rails 3.2 index view I am rendering two partials. <%= render :partial => 'users/user', :locals => {:users => @happy_users} %> <%= render :partial => 'users/user', :locals => {:users => @sad_users} %> and in the partial <% users.each do |user|…
Andy Harvey
  • 12,333
  • 17
  • 93
  • 185
7
votes
3 answers

how to paginate records from multiple models? (do I need a polymorphic join?)

After quite a bit of searching, I'm still a bit lost. There are a few other similar questions out there that deal with paginating multiple models, but they are either unanswered or they pagainate each model separately. I need to paginate all…
7
votes
0 answers

Kaminari (or any pagination) is slow on Joined query

I'm paginating the following query with Kaminari (though I get similar results with will_paginate): Person.joins([:locations=>:location_hour], :friends, :current_images).where(sql_conditions_string).page(params[:page]).per(10) Everything works as…
NAD
  • 615
  • 1
  • 7
  • 20
7
votes
5 answers

uninitialized constant ActionView::CompiledTemplates::BootstrapPagination

I have installed the will_paginate-bootstrap gem to use bootstrap style pagination. I have this in my view: <%= will_paginate @mylist, renderer: BootstrapPagination::Rails %> but it returns this error uninitialized constant…
7
votes
2 answers

Give custom messages in page_entries_info of will_paginate in rails

I am new to rails. I want to display my custom message for page_entries_info. I have gone through following link but cannot understand much. Can anyone please explain in details. how-do-i-specify-custom-wording-in-a-will-paginate-view-helper
Paritosh Singh
  • 6,288
  • 5
  • 37
  • 56
7
votes
2 answers

How to change will_paginate URLs?

I'm trying to change the will_paginate links from the format of /list?page=1 to /list/page/1. I have the routes setup right for this, but will_paginate is using the query string in links rather than my pretty URL style. How to tell it…
Ben G
  • 26,091
  • 34
  • 103
  • 170
7
votes
3 answers

Item's page and will_paginate

I have some photos that are split on successive pages through will_paginate plugin. When you open a photo and then return to all photos using a link, you always return to the first page (e.g. the photo is displayed on page 5, you open the photo,…
collimarco
  • 34,231
  • 36
  • 108
  • 142
6
votes
1 answer

get will_paginate to define a custom offset on the first page

i'm building a news section on my rails website and it uses will_paginate for pagination. now i was wondering how i can specify a custom offset for the first page with will_paginate. something like this: @featured_news = Post.first @news =…
Oliver
  • 801
  • 13
  • 26
6
votes
2 answers

will_paginate -error-undefined method `total_pages'

I am using will_paginate "2.3.15" for my rails app in my units_controller.rb def index @units = Unit.paginate(:all ,:page => params[:page], :order => 'created_at DESC') end in my views(index) <%= will_paginate(@units)%> but it gives…
Harshal_m_joshi
  • 1,489
  • 1
  • 16
  • 27
6
votes
1 answer

Rails will_paginate on two objects on the same page does not work

I have seen something similar asked before, but I can not understand it, and I can not ask for help there because of low reputation to comment. So, I am asking a new question. I am using will_paginate plug in for two objects on the same page, and…
uklp
  • 551
  • 1
  • 6
  • 14
6
votes
1 answer

Rails paginate existing array of ActiveRecord results

I generally use will_paginate for the pagination in my app, but have hit a stumbler on my search feature. I'm using Thinking Sphinx for doing my full-text search, which returns results paginated. The problem I'm having is that after I've received…
6
votes
2 answers

Rails 4 pagination with dynamic data

Hi I have a rails4 app using pagination with the will_paginate gem. Is there a way to handle pagination with objects created very often? If you call the first page and right after that the page 2, considering new objects are created in the meantime,…
stefano_cdn
  • 1,362
  • 2
  • 15
  • 29
6
votes
3 answers

will_paginate gem : Limit number of pages

This is my pagination, I want to limit the number of pages to 10, for example, to don't have the same problem as in the picture. How can I do it using will_paginate gem?
Loenvpy
  • 899
  • 1
  • 10
  • 30
6
votes
1 answer

Passing params from Angular to Rails

I have a Rails application, and am exposing an API to be used by an Angular front-end. I am using the will-paginate gem for paging my large dataset. The gem expects a :page to be passed via the params. The buttons on the page are working fine, and…
port5432
  • 5,889
  • 10
  • 60
  • 97
1 2
3
57 58