Can you confirm Kaminari works well if the Data is fetched from an API through the net (so it is not ActiveRecord or in DB)?
And how to properly use that with Kaminari?
@jianlin, I'm not the author, but first Kaminari works on the AREL scopes in ActiveRecord… so it's unlikely to work with anything that doesn't conform to the ActiveRecord 3 query syntax, which is inherited from AREL.
Also… this is not a support forum… please take your questions to your local mailing list, or directly to the author, a question about Ruby programming is not a Kaminari issue.
this is more like a request for documentation. So that it is clear whether Kaminari must work with ActiveRecord or not. Usually, documentation is quite lacking in the gems world, this concern is being filed as an issue.
refs #47, #68, #74 generic pagination support for Array object
this enables you to paginate through any Arrayish object in this way:
@jianlin Thanks for the feature request.
Just added an initial implementation of generic Arrayish object support e04f65a.
Can you bundle '>= 0.12.0' gem and try something like this?
So, I think the problem wasn't actually a documentation issue in this case, but just an "unimplemented feature".
I'm aware of the documentation poorness though, I'm sorry for that. There are still lot more things to do for this young product. As I'm not really a good English document writer (I sometimes hope I can write everything in japanese!), I always welcome your contribution on documentation as well as Ruby code patch.
Anyway, I hope you like the new feature!
I have currently the same use-case of paginating the result of an API call over the net... However, this API
itself is paginated :-) .... (and has lots of records).
Therefore, I cannot use the use the paginate_array method in this case (but it is very useful otherwise...).
I thought that the easiest way to approach this would be to build by own object (some Enumerable, say) and simply make
sure that it responds to #current_page, #num_pages and #limit_value, so that the paginate helper has everything it
Would you think this is a reasonable approach?
@kisp, this isn't a help forum… but that would be a reasonable implementation (for help questions please see http://www.stackoverflow.com/ )
Yep. Sounds quite reasonable.
I'm happy to include such kind of wrapper class into Kaminari gem, so could you send me your code when finished implementing?
See the wiki for docs