I already do pagination on a non-AR set for my acts_as_indexed plugin.
In your case it would work something like the following:
def fetch(page=1, per_page=10)
total_entries = 1000 # Or whatever method you choose to find the total entries.
returning ::WillPaginate::Collection.new(page, per_page, total_entries) do |pager|
url = "http://www.foo.com/fetch_data?type=products&offset=#{pager.offset}&count=#{pager.per_page}"
results = fetch_example(url)# fetch the actual data here.
pager.replace results
end
end
Controller:
def index
@records = fetch(params[:page])
end
Views:
<%= will_paginate @records %>
Fill in your own methods for fetching and processing the data, and working out the total entries.