kidpollo / tanker

IndexTank Integration with your fav ORM
MIT License
97 stars 30 forks source link

Using kaminari for pagination #43

Closed samzurcher closed 13 years ago

samzurcher commented 13 years ago

As described in the documentation, I define

MY_APPLICATION::Application.config.tanker_pagination_backend = :kaminari

in config/initializers/tanker.rb. Calling Tanker.configuration in the console results in

{:url=>"http://:XXXXXX@XXXX.api.indextank.com"}

As far as I can see, the tanker_pagination_backend wasn't applied. If I now try to use pagination in a view with the help of

<%= paginate @products %>

I get:

undefined method `num_pages' for #WillPaginate::Collection:0x000001042ac538

As far as I can interpret this, will_paginate is used instead of kaminari. What am I doing wrong?

kidpollo commented 13 years ago

Hey @samzurcher I have personally never used kaminary as a pagination backend but I will ask the user that provided the pull requests for this to see if he can help out

arvida commented 13 years ago

Hi, I did the initial support for kaminari in tanker. Yep, looks like the kaminari setting isn't set =) Sorry for the trouble! Did a test now with a new rails 3 app with tanker and kaminari and it looks to be working, the tanker tests passes too. What version of rails, tanker and kaminari are you using? What does your tanker initializer look like?

jbritten commented 13 years ago

Hey @samzurcher -- I was having this exact same issue recently using Rails 3.0.9 and Kaminari 0.12.4. The fix for me was to update my Tanker gem. My Gemfile had been locked at a previous version (like 1.0.0), but when I updated to Tanker 1.1.3 the pagination backend started to be set as expected. Now calling Tanker.configuration in the console shows both the url and the pagination_backend set.

Hope this information helps!

Cheers, Justin

samzurcher commented 13 years ago

Hi all,

Thanks a lot for your help! Indeed, the questions by arvida pointed me into the right direction and jbritten confirmed it - I was using tanker 1.0.0. After upgrading, it is working as advertised.

Best, sam

kidpollo commented 13 years ago

Thanks @arvida @jbritten virtual hugz to u guys!

arvida commented 13 years ago

:beer::beer::beer::beer::beer: