Questions tagged [kaminari]

A Scope & Engine based, clean, powerful, customizable and sophisticated paginator for Rails 3

A Scope & Engine based, clean, powerful, customizable and sophisticated paginator for Rails 3

572 questions
56
votes
3 answers

How to get the total count after Kaminari pagination

I am using rails 3.2. I am paginating my results using .page(1).per_page(10) like @users = User.method().page(1).per_page(10) Now how to find the total count of the users from the pagination As because @users.count gives 10 from the first page…
useranon
  • 29,318
  • 31
  • 98
  • 146
38
votes
1 answer

rails 3,Kaminari pagination for an simple Array

For paginating a common array I got this solution, @arr_name = Kaminari.paginate_array(@arr_name).page(params[:page]).per(PER_PAGE_RECORDS) PER_PAGE_RECORDS is a variable with value as per needed for pagination. Any better Ideas?? Also to have…
Swapnil Chincholkar
  • 2,869
  • 3
  • 22
  • 22
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
31
votes
3 answers

Kaminari & Rails pagination - undefined method `current_page'

I searched and searched, but nothing solved my problem. Here's my controller: def show @topic = Topic.find(params[:id]) @topic.posts = @topic.posts.page(params[:page]).per(2) # 2 for debugging end That functions just fine, because the topic…
user1481539
29
votes
5 answers

Rails 3: undefined method `page' for #

I can't get past this. I know I've read there isn't a page method for arrays but what do I do? If I run Class.all in the console, it returns #, but if I run Class.all.page(1), I get the above error. Any ideas?
Chris Bolton
  • 2,878
  • 6
  • 38
  • 57
24
votes
2 answers

RSpec test broken by pagination (Kaminari)

I have a view spec that was passing but is broken now that pagination (via Kaminari gem) has been added to the view. I'm still trying to get my head around RSpec's syntax...so looking for help in getting this to pass as the page works fine in the…
Meltemi
  • 37,979
  • 50
  • 195
  • 293
22
votes
3 answers

Paginate Multiple Models in Kaminari

I'm creating a search page that will do an application wide search on users, posts, and comments. I currently have: # POST /search def index query = params[:query] @users = User.search(query).page(params[:page]) @posts =…
Stussa
  • 3,375
  • 3
  • 24
  • 35
19
votes
1 answer

How to get page count using Kaminari

I am iterating through a large array of model objects and need to paginate for performance/memory reasons. I want to do something like this: for i in 1..Person.num_pages Person.page(i).each do # work end end Obviously I can get the count…
keithgaputis
  • 731
  • 2
  • 6
  • 11
18
votes
1 answer

Rails 5.0.0.beta1 - Generating an URL from non sanitized request parameters is insecure

We are upgrading from Rails 4.2.5 to 5.0.0.beta1 When testing we expected to see index views rendered with paginated links as before. But we now get an ArgumentError error page, for example: ArgumentError in Transactions#index…
KeithP
  • 1,803
  • 1
  • 16
  • 23
18
votes
4 answers

Reverse pagination with kaminari

I want to create pagination for a messaging system in which the first page shown contains the oldest messages, with subsequent pages showing newer messages. For example, if normal pagination for {a,b,c,d,e,f,g,h,i} with 3 per page is: {a,b,c},…
Nick Ginanto
  • 31,090
  • 47
  • 134
  • 244
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
14
votes
2 answers

Multiple pagination with kaminari via Ajax

I want to apply multiple pagination with Kaminari via Ajax now here is my code for controller def user_note @user = current_user @notes = Bookmark.where('user_id = ? && note is not NULL',current_user.id).order('created_at…
mfq
  • 1,357
  • 13
  • 21
12
votes
4 answers

How to paginate Rabl's collections

I have this template: # app/views/posts/index.rabl collection @posts => :posts attributes :id, :title, :subject child(:user) { attributes :full_name } node(:read) { |post| post.read_by?(@user) } Witch returns: { "posts": [ { …
Zag zag..
  • 6,041
  • 6
  • 27
  • 36
12
votes
1 answer

Pagination for panel in active admin

I am using active admin for admin panel. On User show page I need to show his friends. I have two models User and Friend. I want add pagination in the "friendship with panel" ie user.friends block. How can I add pagination on one panel? Here is the…
Mohit Jain
  • 43,139
  • 57
  • 169
  • 274
11
votes
4 answers

Unwanted form parameters being appended to pagination links

I have a page which is used for searching through listings by submitting data using the supplied forms. The form parameters are submitted via ajax (post request), a new record is created in the searches table and then the listings are displayed…
David Tuite
  • 22,258
  • 25
  • 106
  • 176
1
2 3
38 39