0

I would like to paginate my results from my XML parse. At the moment I get:

undefined method `paginate' for #<Nokogiri::XML::NodeSet:0x0000000374e408>

This is how I am implementing the pagination:

//Controller
require 'will_paginate/array'
def index
  @mycontacts = getcontact.paginate(:page => params[:page], :per_page => 30)
end

I guess that the returned NodeSet is not an array, but in what format is the NodeSet and can I use will_paginate on this or do I have to do something else to paginate my results?

4

1 回答 1

0

这可能对其他人有帮助,所以我在回答自己,需要将节点集转换为数组,以便我可以使用 will_paginate

def index
  @mycontacts = getcontact.to_a.paginate(:page => params[:page], :per_page => 30)
end
于 2013-03-31T15:28:27.687 回答