Let say I have a table named 'products' and Model named 'Product'.
'products' table has 3 fields id,title,price,created
I want to calculate cal_price (which varies per record and day of search) and create a temporary table with 4 fields i.e. id,title,price,cal_price with order by cal_price
Now, all I want is to paginate this temporary table.
using $this->paginate();
eg.
table_products
id title price created
3 demo1 23 2011-12-12
4 demo2 43 2011-12-13
56 demo3 26 2011-12-16
sort 'temp_table' order by cal_price and paginate
temp_table
id title price cal_price created
3 demo1 23 12 2011-12-12
4 demo2 43 43 2011-12-13
56 demo3 26 88 2011-12-16
*The underlying problem to the solution is HOW DO I assign temp_table to a model at run time because once I do it I can use $this->paginate('temp_model') and solve the problem*