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
79
votes
7 answers

Ruby on Rails will_paginate an array

I was wondering if someone could explain how to use will_paginate on an array of objects? For example, on my site I have an opinion section where users can rate the opinions. Here's a method I wrote to gather the users who have rated the…
Brian
  • 5,951
  • 14
  • 53
  • 77
67
votes
5 answers

will_paginate undefined method `total_pages'

What am I missing here? I am using the haml_scaffold generator and the pages work fine with will_paginate. When I start tinkering I end up with this 'total_pages' error and I'm not sure what I am doing that is causing it. Anyone have any insight?…
mikewilliamson
  • 24,303
  • 17
  • 59
  • 90
60
votes
3 answers

Overriding a module method from a gem in Rails

The will_paginate gem is broken on my version of Oracle. The default paginate_by_sql method in the WillPaginate module is inserting an extra 'AS' into a query and causing it to fail. The code itself is easily fixed, but I'm not sure of the best way…
Dave Smylie
  • 2,663
  • 3
  • 25
  • 32
34
votes
5 answers

Paginating an Array in Ruby with will_paginate

I have an array @level1 which looks like this : [[3.0, 4, 2], [2.0, 48, 3], [2.1, 56, 4], ............] I want to apply pagination on this array such each page displays only a few rows at once. I tried this: @temp1 = @level1.paginate(:page =>…
Pi Horse
  • 2,350
  • 8
  • 30
  • 51
26
votes
2 answers

undefined method `paginate' for #

This my code in the index controller. order_customs = Order.select{|order| order.performer.white_label_id==1} @orders_customs_display=order_customs.paginate(:page => params[:page], :per_page => 5) …
Aravind
  • 1,391
  • 1
  • 16
  • 41
25
votes
1 answer

Getting total result count from Rails query using will_paginate

I get a list of objects from my Rails app, and use will_paginate to page as usual, and then I have a little method used to save details of the search to the database: per_page=10 session[:search_params] = params[:search_people] @documents =…
Christian Mayne
  • 1,709
  • 7
  • 26
  • 42
23
votes
6 answers

How to Implement ajax pagination with will_paginate gem

I am using will_paginate gem in my ROR project to show the records in pages. I want the next page to be loaded without reloading the whole page using ajax. I found some examples on the net but they don't work for me. How to do this?
Mohammad Sadiq Shaikh
  • 3,160
  • 9
  • 35
  • 54
20
votes
3 answers

Is it possible to combine will_paginate with find_by_sql?

In my Rails application I want to use the will_paginate gem to paginate on my SQL query. Is that possible? I tried doing something like this but it didn't work: @users = User.find_by_sql(" SELECT u.id, u.first_name, u.last_name, CASE …
Tam
  • 11,872
  • 19
  • 69
  • 119
19
votes
6 answers

will_paginate JSON support?

I wonder if anyone could please tell me if will_paginate can support JSON out of the box or if this has to be hacked? I would like to add page data to the JSON responses while will_paginate manages pagination.
user427165
17
votes
1 answer

Will_paginate Plugin on two objects on same page

Hello I am using will_paginte plugin on two objects on a same page. Like on stackoverflow. There is a profile page on which there is a pagination on two things QUestions and answers. I am having problem ie:-- when user is clicking on questions…
Mohit Jain
  • 43,139
  • 57
  • 169
  • 274
17
votes
1 answer

Customizing Number of Page Links Rendered With will_paginate?

I'm using the will_paginate gem for my Rails project and it's working beautifully. Unfortunately, on paginated result sets with a larger number of pages, the link section is too wide. Instead of: « Previous 1 2 … 5 6 7 8 9 10 11 12 13 … 18 19 Next…
Moe
  • 641
  • 1
  • 7
  • 16
16
votes
4 answers

will_paginate with named_scopes

I'm using will_paginate for pagination, which has been working well so far, except for this one thing. If I try to paginate a scope, for instance class User < ActiveRecord::Base named_scope :scope, lambda { etc…
Lowgain
  • 3,254
  • 5
  • 27
  • 30
16
votes
3 answers

Rails 4 pagination, will_paginate vs. Kaminari using with bootstrap3

I understand Kaminari perform well with Rails3 reading this article: Rails 3 pagination, will_paginate vs. Kaminari, but how about with Rails4? Also, when stylizing them with Bootstrap3, which gem is easier solution?
tkymtk
  • 2,695
  • 3
  • 21
  • 37
16
votes
2 answers

will_paginate with endless Scrolling | Rails4

THIS IS THE SOLUTION So i'm using will_paginate / Bootstrap Will Paginate with Endless Scrolling. To get the Pagination working: 1.) In my Controller i updated my index action with @clips = Clip.order("created_at…
14
votes
3 answers

will_paginate find out if I'm on the last page

I'm trying to use will paginate with ajax, but I don't show the will_paginate buttons... instead I use a see more button, that makes an Ajax request and append the results to the page. what I'm trying to do is disable this see more button if I hit…
zeacuss
  • 2,563
  • 2
  • 28
  • 32
1
2 3
57 58