简体   繁体   English

如何在HTTParty中使用will_paginate?

[英]How to use will_paginate with HTTParty?

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? 如果我有一个JSON数据源(例如: http ://marketplace.envato.com/api/edge/new-files:themeforest,site-templates.json),我可以使用will_paginate进行分页吗? I use HTTParty for the JSON so it doesn't go through ActiveRecord, that's the problem. 我使用HTTParty作为JSON,因此它没有通过ActiveRecord,这就是问题所在。 How can I use HTTParty together with will_paginate without ActiveRecord? 如何在不使用ActiveRecord的情况下将willdp一起使用HTTParty?

you can use will_paginate for array create array from json response just use 你可以使用will_paginatejson response使用array创建数组
require 'will_paginate/array'
and

array.paginate(:page => 100, :per_page => 10)

Thank you 谢谢

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM