Hi, I''ve just switched to will_paginate, which is impressive and easy
to
use!
I have a question regarding conditions:
I build a query using values from the params that were entered onto a
web form using something like
:conditions => [" foo like x and bar like y",
params[:x]+"%",
params[:y]+"%"]
It would appear that the conditions need to be respecified on each page
so I have had to remember them in the session:
unless params[:page]
session[:search] = ["category_id = ? and foo like ?
and bar like ?",
params[:item][:category_id],
params[:item][:foo]+"%",
params[:item][:bar]+"%"]
end
@items = Item.paginate :page => params[:page],
:conditions => session[:search]
This works, but have I got it right, or is there a better way?
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---