If I have a JSON data source (ex: http://marketplace.envato.com/api/edge/new-files:themeforest,site-templates.json), can I use will_paginate for pagination? I use HTTParty for the JSON so it doesn't go through ActiveRecord, that's the problem. How can I use HTTParty together with will_paginate without ActiveRecord?
Asked
Active
Viewed 693 times
1
-
1not clear...yet you can use `will_paginate` for `array` just use `require 'will_paginate/array'` and `array.paginate(:page => 100, :per_page => 10)` – Rajarshi Das Aug 28 '13 at 06:08
-
ok.. So I have to convert the JSON to Array first? You gave me an idea. I'll try it. =) – tungsten_carbide Aug 28 '13 at 06:20
-
@tungsten_carbide if you get help from this person then please vote up – Aug 28 '13 at 06:33
1 Answers
3
you can use will_paginate
for array
create array from json response
just use
require 'will_paginate/array'
and
array.paginate(:page => 100, :per_page => 10)
Thank you

Rajarshi Das
- 11,778
- 6
- 46
- 74
-
It worked. I also found some other useful pages http://stackoverflow.com/questions/13187076/paginating-an-array-in-ruby-with-will-paginate#_=_ and http://stackoverflow.com/questions/4352895/ruby-on-rails-will-paginate-an-array – tungsten_carbide Aug 31 '13 at 03:37