Skip to content

Tarik Billa

  • Web Development
    • html
    • vue.js
    • laravel
    • css
    • javascript
    • jquery
    • node.js
    • php
    • asp.net
  • Programming
    • python
    • java
    • c
    • c++
    • c#
  • git
  • android

kaminari

Kaminari & Rails pagination – undefined method `current_page’

January 1, 2024 by Tarik

Try with: def show @topic = Topic.find(params[:id]) @posts = @topic.posts.page(params[:page]).per(2) end And then: <%= paginate @posts %>

Categories ruby-on-rails Tags kaminari, ruby, ruby-on-rails Leave a comment

Paginating an Array in Ruby with will_paginate

September 24, 2023 by Tarik

See https://github.com/mislav/will_paginate/blob/master/lib/will_paginate/array.rb Just require ‘will_paginate/array’ before you try it and it will work just fine. If it were me, I’d put that in say config/initalizers/will_paginate_extensions.rb so it’s available right away and from everywhere.

Categories ruby-on-rails Tags kaminari, ruby, ruby-on-rails, ruby-on-rails-3, will-paginate Leave a comment

rails 3,Kaminari pagination for an simple Array

August 21, 2023 by Tarik

This is the only available helper method to paginate an array object using Kaminari. Another alternative is, as suggested solution in kaminari wiki page, add the instance methods to the array object. If you are trying a common solution based on the ActiveModel return type ( .all returns array and .where returns ARL) then following … Read more

Categories ruby-on-rails Tags kaminari, ruby-on-rails Leave a comment

How to get the total count after Kaminari pagination

April 16, 2023 by Tarik

As mentioned in the question, you can get the total count of the records with @users.total_count I’ve added this as an answer for the sake of completeness.

Categories ruby-on-rails-3.1 Tags kaminari, ruby-on-rails-3.1 Leave a comment

Tarik Billa

Software Engineer
tarikbilla@gmail.com
+8801884414000
  • Reuse a hash in YAMLApril 17, 2024
  • Dockerfile: how to redirect the output of a RUN command to a variable?April 16, 2024
  • How to cd to a directory with spaces in the directory name?April 16, 2024
  • Maximum MIME type length when storing the type in a databaseApril 16, 2024
  • What is the difference between Unit, Integration, Regression and Acceptance Testing?April 16, 2024
© 2026 Tarik Billa