Ruby on Rails will_paginate an array
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I was wondering if someone could explain how to use will_paginate on an array of objects? For example, on my site I have an opinion section where users can rate the opinions. Here's a method I wrote to gather the users who have rated the opinion: def agree_list list = OpinionRating . find_all_by_opinion_id ( params [: id ]) @agree_list = [] list . each do | r | user = Profile . find ( r . profile_id ) @agree_list << user end end Thank you 回答1: will_paginate 3.0 is designed to take advantage of the new ActiveRecord::Relation in