will_paginate without use of activerecord

Posted by truthSeekr on Stack Overflow See other posts from Stack Overflow or by truthSeekr
Published on 2010-02-17T08:40:26Z Indexed on 2010/04/15 15:33 UTC
Read the original article Hit count: 231

I apologize if this is a trivial question or my understanding of rails is weak.

I have 2 actions in my controller, index and refine_data.

index fetches and displays all the data from a database table.

refine_data weeds out unwanted data using regex and returns a subset of the data.

Controller looks like:

def index
    Result.paginate :per_page => 5, :page => params[:page], :order => 'created_at DESC'
end

def refine_data
   results = Result.all
   new_results = get_subset(results)
   redirect_to :action => 'index'
end

I would like to redirect the refine_data action to the same view (index) with new_results.

As new_results are not from the database table (or model), how do I go about constructing my paginate?

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about ruby-on-rails-plugins